Skip to content

Reusable buffers as parameter for getters #127

@mufumbo

Description

@mufumbo

Hi,

It would be great to be able to pass custom byte[] buffers as parameters for the GET and SET methods. Using the byte[], offset and size as parameters.

Basic use case for SET:

  1. I have already a buffer that converts Java objects to Kryo serialized objects using a byte[] buffer. (instead of creating new byte[] every time and destroying the GC)
  2. Then I use this buffer (with offsets) to compress it using Snappy (using offsets again, instead of generating new byte[] every time and destroying the GC again)
  3. Then, NOW it would be amazing to use the buffer from 1) here and flush it using offsets back to the memcached socket.

Basic use case for GET:

  1. I want to use my custom byte[] buffer to get the data from a memcached key
  2. From that result (offset + len), I can then pass this same buffer to a Snappy.decompress method, using another cached buffer.
  3. From this Snappy decompresse result, then I can use a Kryo.unserialize using the buffer from 1).

Again, the goal is to not create any objects through the usage of memcached. This random creation of byte[] kills the JVM GC, at least with G1 or concmarksweep. We had to migrate to shenoah for faster "Stop the World" GC, but still it would be wonderful to not create new byte[] for every single object inside memcached (we have millions).

I couldn't see how to do this with XMemcached and Spymemcached, any suggestion how to achieve this with Folsom would be greatly appreciated. I can send a PR if someone send me some pointers where to touch.

thanks!
rafa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions