Kong/kong

Is this normal? How to reduce memory usage. .

fairyqb opened this issue · 9 comments

Is there an existing issue for this?

  • I have searched the existing issues

Kong version ($ kong version)

kong all

Current Behavior

my server has 20 cores and 32GB of memory. The nginx process corresponding to KONG is 1.5G RES for each nginx process and 300MB of shared memory.
(20 * 1.2 GB) + 300MB = 24.3GB

Memory usage is 24.3/32= 75%, and the memory is very high, almost reaching 80%.

The CPU is usually very low, with a usage rate of 10%.

Expected Behavior

Is this normal? How to reduce memory usage. .

Steps To Reproduce

No response

Anything else?

No response

Information supplement:

The data cached by my luajit vm is all that is needed.

@chronolaw What is the feedback? I don't understand, thank you

I am not an expert of performance tuning, perhaps others could answer this question.

Now each nginx process reaches 2GB. Should I reduce the number of worker processes or increase the memory? Which solution is better?

Now each nginx process reaches 2GB. Should I reduce the number of worker processes or increase the memory? Which solution is better?

In general, increasing the number of worker processes will not decrease your overall memory usage. Kong Gateway's memory usage generally depends on the size of the configuration more than on the amount of traffic that it handles, but this is not always the case. To give you further advice, details about your configuration (number of configuration entities, plugin configurations etc.) as well as the amount (rps) and nature (protocol, request sizes) of the traffic that you're handling are needed.

It can be said that worker process sizes of hundreds of megabytes are not untypical, but it is not normal to see the memory usage increase without changes in configuration or load patterns. You reported that "Now" the size of your workers has grown from "1.5" to "2" GB per worker process. What happened between "before" and "Now"? Did you make changes?

Now each nginx process reaches 2GB. Should I reduce the number of worker processes or increase the memory? Which solution is better?

In general, increasing the number of worker processes will not decrease your overall memory usage. Kong Gateway's memory usage generally depends on the size of the configuration more than on the amount of traffic that it handles, but this is not always the case. To give you further advice, details about your configuration (number of configuration entities, plugin configurations etc.) as well as the amount (rps) and nature (protocol, request sizes) of the traffic that you're handling are needed.

It can be said that worker process sizes of hundreds of megabytes are not untypical, but it is not normal to see the memory usage increase without changes in configuration or load patterns. You reported that "Now" the size of your workers has grown from "1.5" to "2" GB per worker process. What happened between "before" and "Now"? Did you make changes?

from "1.5" to "2" GB per worker process., kong.cache is all that is needed.

Hi @fairyqb
Could you give us more information about the Kong instance you are running. Could you provide the details that @hanshuebner asked in the previous message?

To give you further advice, details about your configuration (number of configuration entities, plugin configurations etc.) as well as the amount (rps) and nature (protocol, request sizes) of the traffic that you're handling are needed.