Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat's the best serialization method for objects in memcached?
    primarykey
    data
    text
    <p>My Python application currently uses the <a href="http://www.tummy.com/Community/software/python-memcached/" rel="nofollow noreferrer">python-memcached API</a> to set and get objects in memcached. This API uses Python's native <a href="http://docs.python.org/library/pickle.html" rel="nofollow noreferrer">pickle module</a> to serialize and de-serialize Python objects. <p>This API makes it simple and fast to store nested Python lists, dictionaries and tuples in memcached, and reading these objects back into the application is completely transparent -- it just works.<p>But I don't want to be limited to using Python exclusively, and if all the memcached objects are serialized with pickle, then clients written in other languages won't work.<p>Here are the cross-platform serialization options I've considered:<p></p> <ol> <li>XML - the main benefit is that it's human-readable, but that's not important in this application. XML also takes a lot space, and it's expensive to parse.<p></li> <li>JSON - seems like a good cross-platform standard, but I'm not sure it retains the character of object types when read back from memcached. For example, according to <a href="https://stackoverflow.com/questions/408866/python-human-readable-object-serialization">this post</a> tuples are transformed into lists when using <a href="http://pypi.python.org/pypi/simplejson/" rel="nofollow noreferrer">simplejson</a>; also, it seems like adding elements to the JSON structure could break code written to the old structure<p></li> <li><a href="http://code.google.com/apis/protocolbuffers/docs/overview.html" rel="nofollow noreferrer">Google Protocol Buffers</a> - I'm really interested in this because it seems very fast and compact -- at least 10 times smaller and faster than XML; it's not human-readable, but that's not important for this app; and it seems designed to support growing the structure without breaking old code<p></li> </ol> <p>Considering the priorities for this app, what's the ideal object serialization method for memcached?<p></p> <ol> <li>Cross-platform support (Python, Java, C#, C++, Ruby, Perl)<p></li> <li>Handling nested data structures<p></li> <li>Fast serialization/de-serialization<p></li> <li>Minimum memory footprint<p></li> <li>Flexibility to change structure without breaking old code</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload