Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a large amount of integer => string values that I want stored in a RAM on a smaller server. However, it seems that data stores like membase and redis hash the key resulting in a key that is much larger to store than a integer. (I assume they do this since they assume keys will contain strings and need to be setup for scaling to multiple nodes).

Are there any key stores that use integer keys so I can cram a few million objects into just a few megabytes of memory? I would also like it to flush to disk every once in a while if possible.

share|improve this question

closed as off topic by John Gardeniers, Magellan, Ward, rnxrx, Michael Hampton Oct 14 '12 at 21:01

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
You might want to ask this question on Stack Overflow instead. –  jftuga Jul 9 '11 at 5:19
add comment

1 Answer

The amount of memory used will be far more dependent on the size of the string values than the keys, given that even if you're storing a 32-bit integer as a string it can take a maximum of 10 bytes. Sure, that's 2.5 times the storage, but how small are your values in that case?

I'm inclined to think that you're optimising at the wrong level; hardware is cheap, throwing a bit more RAM at a problem is likely to be far more cost-effective than trying to find a very, very specialised data store (and, in all likelihood, by "find" I mean "write and maintain it yourself").

share|improve this answer
    
I guess that is true, I looked but I couldn't find one. However, storing a 32-bit key (~4 billion) is actually 4x smaller than a 128 bit MD5 (or 160 bit sha1) key hash. The values are either very small strings or integers themselves so they size of the key really does make a difference. Still, I guess I don't have much choice but to throw more RAM at it. –  Xeoncross Jul 9 '11 at 18:42
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.