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

Falling throughput when extracting path information #1607

Closed
morphy2k opened this issue Jul 15, 2020 · 4 comments · Fixed by #1609
Closed

Falling throughput when extracting path information #1607

morphy2k opened this issue Jul 15, 2020 · 4 comments · Fixed by #1609

Comments

@morphy2k
Copy link

Your issue may already be reported!
Please search on the Actix Web issue tracker before creating one.

Expected Behavior

Throughput should be constant.

Current Behavior

Throughput drops with the number of requests.

Possible Solution

...

Steps to Reproduce (for bugs)

Link to example

  1. Build and start the server
  2. Benchmark the root endpoint where no path information is extracted
  3. Benchmark the ID endpoint where path information is extracted
  4. Compare the results

Context

I noticed the issue while developing a search backend.
As soon as I extract path or query information, the throughput drops continuously during benchmarking.
In addition, regardless of whether I extract information, I noticed that the memory consumption is continuously increasing, which could indicate a memory leak.

Your Environment

  • CPU Ryzen 5 2600
  • RAM 16GB DDR4-3200
  • OS Fedora 32 Workstation (5.7.8-200.fc32.x86_64)
  • Rust Version (I.e, output of rustc -V): rustc 1.44.1 (c7087fe00 2020-06-17)
  • Actix Web Version: 3.0.0-beta.1
@fakeshadow
Copy link
Contributor

I believe this line is the cause of your problem.

inner.app_data.push(self.data.clone());

Commenting it and your example runs OK for me. It would be good if someone can look into it and see if it's ok to remove it.

@robjtede
Copy link
Member

for context: #1486 (comment)

@fakeshadow
Copy link
Contributor

fakeshadow commented Jul 16, 2020

Or maybe we can clear the data pushed to HttpRequest when dropping it too(If it returns to pool).
I'm not familiar with how cached pool works so I could be wrong but it seems in certain cases we just keep push data and the vec become too long.
Well actually if a request is already in cache do we really need to push data again?

@morphy2k
Copy link
Author

Can confirm that this causes the problem, as well as the high memory consumption #1606
As soon as I comment out the line, the memory consumption and throughput remains constant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants