Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IApplicationBuilder.UseSwaggerForOcelotUI takes a lot memory #255

Closed
mastak-in-ua opened this issue Jan 27, 2023 · 2 comments
Closed

IApplicationBuilder.UseSwaggerForOcelotUI takes a lot memory #255

mastak-in-ua opened this issue Jan 27, 2023 · 2 comments
Assignees
Labels
waiting-8-days Closing after 8 days of waiting for the additional info requested.

Comments

@mastak-in-ua
Copy link

Ocelot requires up to 500Mb additional memory to start a service with UseSwaggerForOcelotUI enabled.

How to reproduce:

  1. run service without UseSwaggerForOcelotUI enabled:
    image
  2. run service with UseSwaggerForOcelotUI enabled:
    image

swagger.json file size 688Kb, about 300 operations
routes.json 56Kb with routes to 2 external services and gateway inself

If use ocelot routes with a service with only a few operations ( 10 operations ) it takes much less memory:
image

So it looks like more operations in target service - ocelot will take and keep more memory.

@Burgyn
Copy link
Owner

Burgyn commented Jan 27, 2023

Hi @mastak-in-ua

Yes, you're right. This is the scenario with a certain post of operations and dependencies in the schema. The problem is how I parse JSON and try to match ocelot routing to swagger endpoints.

Unfortunately I don't have the time to fix this right now. If you feel like it, you can try it. It's all done in the SwaggerJsonTransformer class.

If not then you can try use the parameter RemoveUnusedComponentsFromScheme

"SwaggerEndPoints": [
{
  "Key": "projects",
  "RemoveUnusedComponentsFromScheme": false,
  "Config": [
    {
      "Name": "Projects API",
      "Version": "v1",
      "Service": {
        "Name": "projects",
        "Path": "/swagger/v1/swagger.json"
      }
    }
  ]
}

@Burgyn Burgyn added the waiting-8-days Closing after 8 days of waiting for the additional info requested. label Jan 27, 2023
@github-actions
Copy link

github-actions bot commented Feb 5, 2023

Closing after 8 days of waiting for the additional info requested.

@github-actions github-actions bot closed this as completed Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-8-days Closing after 8 days of waiting for the additional info requested.
Projects
None yet
Development

No branches or pull requests

2 participants