Memcached replacement in GO!

506 views
Skip to first unread message

Slawomir Pryczek

unread,
Nov 16, 2016, 9:10:30 AM11/16/16
to golang-nuts
Hi Guys, I wrote memcached like PHP-client and GO-server, with additional features, it is in production for a long time in my company (>6 months)... now it's open so if you're looking for some modern caching mechanism for PHP I invite everyone to use it... best of all, it works on windows and linux, has snapshots and rebalance and doesn't require to install anything for PHP, just the server.


Why you should use it?
- Much better Garbage Collection mechanism, that isn't skipping items with short TTLs like LRU, so memory is not occupied with garbage data even if item TTLs differ a lot.
- It doesn't require PHP extension (memcached ext. is buggy in PHP7)
- It allows modern caching patterns that prevent stampeding herd
- Very easy to use atomic operations based on generating value using callbacks
- Optimal caching and network settings (NODELAY, allow to set compression by ip range)

Let me know if you have any feedback!

Tamás Gulácsi

unread,
Nov 16, 2016, 2:50:19 PM11/16/16
to golang-nuts


2016. november 16., szerda 15:10:30 UTC+1 időpontban Slawomir Pryczek a következőt írta:
Hi Guys, I wrote memcached like PHP-client and GO-server, with additional features,

Henrik Johansson

unread,
Nov 16, 2016, 2:52:14 PM11/16/16
to Tamás Gulácsi, golang-nuts
Groupcache is really cool but for mutable data it requires some hoops to be useable.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Slawomir Pryczek

unread,
Nov 16, 2016, 4:31:54 PM11/16/16
to golang-nuts

It's meant for different purpose i think (eg. CAS, inc/dec, php client, fast item reclaim)...

Main purpose for this project is to allow easy operations on items when there's a lot of paralell access to the same keys, so there's eg. a very easy way of atomically modifying a value using just callback (that isn't something that you can easily do using eg. memcached), easy way of doing caching with automatic stampeding herd prevention, some operations that will make managing dynamic lists of items easier, large items, etc.

Generally it's what we were missing in memcached, for our company projects...

Jesper Louis Andersen

unread,
Nov 16, 2016, 4:52:55 PM11/16/16
to Slawomir Pryczek, golang-nuts
On Wed, Nov 16, 2016 at 3:10 PM Slawomir Pryczek <slawe...@gmail.com> wrote:

- Much better Garbage Collection mechanism, that isn't skipping items with short TTLs like LRU, so memory is not occupied with garbage data even if item TTLs differ a lot.


Could you expand on what this problem is? It sounds like a subtlety many people implementing LRU will hit and overlook. Perhaps give an example of what happens.
 

Slawomir Pryczek

unread,
Nov 16, 2016, 6:58:48 PM11/16/16
to golang-nuts, slawe...@gmail.com

Here is nice page describing the issue:

>The reality in nk.pl was that evictions of valid items happened hundreds
>of times per second even though there were 50% of expired items, 
>because there is no inherent correlation between TTL and the pattern of usage. 

So basically if you have a plenty of items with short TTL, like 10-30 seconds, and then some items that need to live long, eg. 10 minutes, then the short living items will pile up at the beginning of the list, and memory will never be reclaimed, because GC will not pass the "barrier" created by long living items at the end (it starts from the end), because it'll clean only first expired item(s) found. In recent memcached release there is some mechanism to traverse all items from time to time... not sure how good it works, 


Basically the memcache*d* extension for PHP was buggy and that's one of the reason for writing my project ...

Hirotaka Yamamoto (ymmt2005)

unread,
Nov 16, 2016, 8:51:38 PM11/16/16
to golang-nuts, slawe...@gmail.com
> Basically the memcache*d* extension for PHP was buggy 

yeah, and that's the reason I wrote our own memcached client for PHP5 & 7.
We believe it's very stable as we do not experience even a single failure in our
cloud service for years.

Please try out!
https://github.com/cybozu/php-yrmcds/

2016年11月17日木曜日 8時58分48秒 UTC+9 Slawomir Pryczek:

Slawomir Pryczek

unread,
Nov 17, 2016, 11:21:36 AM11/17/16
to golang-nuts, slawe...@gmail.com
Interesting, thanks for the link... wasn't able to find this in google when i was looking for some working extension the last time... we'll try it out for some services :)
Reply all
Reply to author
Forward
0 new messages