Using memcached with Java and ScheduledFuture objects -


i've been playing around caching objects (by first creating own cache turned out stable implementation inefficient) , trying hand @ using memcached.

although memcached works beautifully, i've ran problem.

how i'm using objects follows:

  • i read data database object, store object in memcached.
  • every couple of minutes retrieve object memcached, retrieve additional data either database or other objects in memcached, update object new / relevant data, store object memcached.
  • objects need viewed pulled memcached, packaged , sent onto client-side application display.

this works well, except when number of objects i'm creating-storing-updating-viewing in memcached becomes high. java/tomcat-jvm doesn't seem garbage-collecting "fast enough" on objects pulled out of memcached, , vm runs out of memory.

i'm limited 8gb of memory (and preferably bring down 4 if can - using memcached), question is, there solution in preventing jvms memory usage expanding fast (or tune garbage collector)?

(ps have considered using guava cache google, limits options in concurrency e.g. if have restart tomcat, , using both guava , memcached seems duplication of sorts i'd avoid of possible)

-- hein.

the garbage collector can't "too slow" , run out of memory. before throwing outofmemoryerror, garbage collector guaranteed run. if cannot free enough memory error thrown.

you should use profiler see whether have memory leaks, or if you're hanging on many objects.

afterwards may want tune gc improve performance, see example here: gc tuning


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -