Skip to content

Memory spikes on AWS EC2 #2291

@satviktechie1986

Description

@satviktechie1986

I am using ocelot Version="24.0.0" in .net 7 microservices to route request from front end applications , but sometime i am running into sudden memory spikes on aws ec2 , initially memory was near 8% that went to 16% somehow on ec2 and it not getting down during off business working hours , below is my ocelot configuration in program.cs

builder.Configuration.AddJsonFile($"Ocelot/ocelot.{builder.Environment.EnvironmentName}.json", optional: false, reloadOnChange: true);
builder.Services.AddOcelot(builder.Configuration);

await app.UseOcelot();

ocelot.production.json file :

{
"Routes": [
{
//Insurance API
"DownstreamPathTemplate": "/api/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "xxx",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/insurance/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
//CRM API
"DownstreamPathTemplate": "/api/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "xxx",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/CRM/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
//Operation API
{
"DownstreamPathTemplate": "/api/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "xxx",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/operation/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
//Sales API
{
"DownstreamPathTemplate": "/api/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "xxx",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/sales/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
//Address API
{
"DownstreamPathTemplate": "/API/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "xxx",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/address/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},

//Property API
{
  "DownstreamPathTemplate": "/API/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
                "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/Property/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},

// Document API
{
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
                "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/Document/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //Vision MiddleWare API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "https",
  "DownstreamHostAndPorts": [
    {
               "Host": "xxx",
      "Port": 443
    }
  ],
  "UpstreamPathTemplate": "/api/Vision/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //Third Parth API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
                "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/ThirdPartyAPI/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //Referencing API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
               "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/referencing/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //Rent Guarantee API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
               "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/rentguarantee/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //Finance API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
               "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/finance/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //UltimateLegal API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
                "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/ultimatelegal/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //Configuration API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {          "Host": "xxx",

      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/configuration/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //DirectToLandlord API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
               "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/directtolandlord/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //Claim API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
                "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/claim/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //Doc verification API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
                "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/docverification/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
},
{
  //FinanceMS API
  "DownstreamPathTemplate": "/api/{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
                "Host": "xxx",
      "Port": 80
    }
  ],
  "UpstreamPathTemplate": "/api/financems/{everything}",
  "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
}

],

"GlobalConfiguration": {
"BaseUrl": "https://api-gateway.xxx.xxx.xxx"
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions