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

Memcached eats memory unnecesarily #14

Closed
GoogleCodeExporter opened this issue Apr 25, 2015 · 2 comments
Closed

Memcached eats memory unnecesarily #14

GoogleCodeExporter opened this issue Apr 25, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link
Contributor

__What steps will reproduce the problem?__
1. Start memcached with a big memory limit (e.g. -m 1024)
2. Populate this memcached instance with a rate of 1 MB per second, where
each item has a validity timeout of 16 seconds. Use random strings or
numbers as keys.

__What is the expected output?__
It is expected that the memory allocated by memcached is about 16 MB (+some
overhead), because after filling memcached with 16MB worth of data, the
items start to become invalid, thus, the rate of items becoming invalid is
the same as the rate of new items. Thus, the amount of memory needed
remains rougly 16MB.

__What do you see instead?__
The memory allocated by memcached increases, until reaching a limit at
around 1024MB. Thus, memcached consumes much more memory than needed.
Memcached should be conservative with memory, and free old (invalid) items
first before requesting new memory from the operating system.

__What version of the product are you using? On what operating system?__
memcached 1.2.2 on Linux 2.6.18-6-amd64

__Please provide any additional information below.__

Original issue reported on code.google.com by xuan--20...@baldauf.org on 6 Feb 2009 at 10:48

@GoogleCodeExporter
Copy link
Contributor Author

Personally I would not call this a bug, but more an enhancement request (You
specified that memcached could use 1GB memory and it does not use more than 1GB 
memory..)

By trying to reclaim expired items before we try to allocate new memory we will 
not
grab the mutex protecting the slab allocator.

I have created a patch at:
http://github.com/trondn/memcached/commit/83da85eca91c3dd9777f1479e7d5b1c30156db
fb


Original comment by trond.no...@gmail.com on 17 Mar 2009 at 11:46

  • Changed state: Started
  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

@GoogleCodeExporter
Copy link
Contributor Author

I pushed this.  I like it and know how much pain you had to go through to test 
it.  :)

Original comment by dsalli...@gmail.com on 17 Mar 2009 at 9:37

  • Changed state: Fixed

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

No branches or pull requests

1 participant