Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 143433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:05:40+00:00 2026-05-11T08:05:40+00:00

My Python application currently uses the python-memcached API to set and get objects in

  • 0

My Python application currently uses the python-memcached API to set and get objects in memcached. This API uses Python’s native pickle module to serialize and de-serialize Python objects.

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.

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.

Here are the cross-platform serialization options I’ve considered:

  1. 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.
  2. 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 this post tuples are transformed into lists when using simplejson; also, it seems like adding elements to the JSON structure could break code written to the old structure
  3. Google Protocol Buffers – 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

Considering the priorities for this app, what’s the ideal object serialization method for memcached?

  1. Cross-platform support (Python, Java, C#, C++, Ruby, Perl)
  2. Handling nested data structures
  3. Fast serialization/de-serialization
  4. Minimum memory footprint
  5. Flexibility to change structure without breaking old code
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:05:41+00:00Added an answer on May 11, 2026 at 8:05 am

    I tried several methods and settled on compressed JSON as the best balance between speed and memory footprint. Python’s native Pickle function is slightly faster, but the resulting objects can’t be used with non-Python clients.

    I’m seeing 3:1 compression so all the data fits in memcache and the app gets sub-10ms response times including page rendering.

    Here’s a comparison of JSON, Thrift, Protocol Buffers and YAML, with and without compression:

    http://bouncybouncy.net/ramblings/posts/more_on_json_vs_thrift_and_protocol_buffers/

    Looks like this test got the same results I did with compressed JSON. Since I don’t need to pre-define each structure, this seems like the fastest and smallest cross-platform answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 176k
  • Answers 176k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think we need to clarify better some points: Are… May 12, 2026 at 3:13 pm
  • Editorial Team
    Editorial Team added an answer You should look into implementing IDataErrorInfo as described in this… May 12, 2026 at 3:13 pm
  • Editorial Team
    Editorial Team added an answer For a stand alone version you can use SnippetEditor May 12, 2026 at 3:13 pm

Related Questions

If you install multiple versions of python (I currently have the default 2.5, installed
For one of my clients, I am generating a clients list from the Django
I'm developing a Python application; it has all its code in one package and
I'm thinking how to arrange a deployed python application which will have a Executable

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.