flomesh-io / pipy

Pipy is a programmable proxy for the cloud, edge and IoT.
https://flomesh.io/pipy
Other
743 stars 70 forks source link

Suspicious memory usage #105

Closed ethinx closed 1 year ago

ethinx commented 1 year ago

What happened

Run pipy proxy with script in sample/http, client send requests to route /, /api, /api/private, /hi, /home in http/https randomly. Run several rounds of the test, and I notice that the memory usage of pipy may ramp up at the time of new run starts.

Reproduce the issue

  1. Start pipy with script in sample/http, two upstreams, and one http server for responding the pipy logging request
  2. Run test by k6 and the attached test.js.gz script several times
    while true; do ./k6 run -d 2m -u 1000 test.js; sleep 180; done

Expect behavior

Should some of the memory be recycled after testing, or should the mem usage be stable?

Screenshots

CleanShot 2022-08-04 at 10 10 26@2x

Version info

Version     : 0.50.0-37
Commit      : 5c115a842c4e98559fd83a6271be2d3ba79ef914
Commit Date : Tue, 26 Jul 2022 19:08:51 +0800
Host        : Linux-5.15.0-1014-azure x86_64
OpenSSL     : OpenSSL 1.1.1q  5 Jul 2022
Builtin GUI : No
Tutorial    : No
pajama-coder commented 1 year ago

Thanks for the report.

From my test here, it seems to happen only with the TLS path. Could you please skip TLS in your test just to see if that's also true in your environment?

ethinx commented 1 year ago

I tried another round of test, exclude the TLS urls, the memory usage could keep stable till now.

But at the first few hours, memory still ramp up several times. Not confident, I'm trying reproducing it, if possible.

Will be back if there is any further update.

ethinx commented 1 year ago

Comes after two days test, with HTTP url, the usage change slightly.

btw, i started 4 pipy instances with --reuse-port each time, hope this is irrelevant.

image
pajama-coder commented 1 year ago

This issue was found in a very old version. Since it hasn't been seen in other versions later on, I'll close it for now.