After listening to the talk, it would be useful if Guava's cache could
be told the maximum size in memory to consume instead of the number of
elements. So I could say, this Java process is given 32 GB of memory,
I'll give the cache 512 MB.
This would make me feel better than just pulling a number out of the air
or manually sizing the cache by trying to find the object size.
Is this something that could be added to Guava? If not, I recall seeing
a page showing the memory usage of MapMaper's maps with varying settings
(softValues, softKeys, etc), but cannot find it now. This page seems to
have used some code that can determine how large a Java object is that I
could use; anybody know this project?
Blair
[1] http://crazybobs-talks.googlecode.com/svn/trunk/out/references.pdf
[2] http://www.parleys.com/#st=5&id=2657&sl=53
--
guava-...@googlegroups.com
Project site: http://guava-libraries.googlecode.com
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: http://code.google.com/p/guava-libraries/issues/entry
To get help: http://stackoverflow.com/questions/ask (use the tag "guava")
A weight is really the only option.
I don't care of one object is 50% larger than another one, so it
doesn't look like a weights will help solve the problem, as I still
need to know how much memory a single cached object will take. I'm
thinking I would effectively give each object the same weight.
Blair
Judging from what people have said, the web page showing the sizes the
different MapMaker maps was manually done?
Blair
Well, sounds like you have a relatively good estimate, the length of
the binary representation you get from the server.
>
> I don't care of one object is 50% larger than another one, so it doesn't
> look like a weights will help solve the problem, as I still need to know how
> much memory a single cached object will take. I'm thinking I would
> effectively give each object the same weight.
I don't know about ZeroC, but for protobufs, the ratio is about this:
for N bytes of binary representation, you need ~10N memory footprint
for the corresponding object graph in java. I wouldn't expect ZeroC to
differ by much.