HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
grahamking
Key-Value-Polyglot
C2012–2012
grahamking / Key-Value-Polyglot

Key-Value-Polyglot

A basic key-value store, repeated in C, Go, Python (basic, gevent, and diesel), Ruby (event machine), Java, Scala, Haskell, and NodeJS.

3Distinct people
3Mentions
0Explicit recommenders
161GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A basic key-value store, repeated in C, Go, Python (basic, gevent, and diesel), Ruby (event machine), Java, Scala, Haskell, and NodeJS.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by week3 dated mentions

Observed mentions: 2012-03-21 05:06:06 UTC to 2012-05-22 09:10:27 UTC. Weeks start Monday, UTC.

0122012-03-19 00:00:00 UTC to 2012-03-26 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 commentsMar 192012-03-26 00:00:00 UTC to 2012-04-02 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-04-02 00:00:00 UTC to 2012-04-09 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-04-09 00:00:00 UTC to 2012-04-16 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-04-16 00:00:00 UTC to 2012-04-23 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsApr 162012-04-23 00:00:00 UTC to 2012-04-30 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-04-30 00:00:00 UTC to 2012-05-07 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-05-07 00:00:00 UTC to 2012-05-14 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-05-14 00:00:00 UTC to 2012-05-21 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-05-21 00:00:00 UTC to 2012-05-28 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsMay 21

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Mar 192012-03-19 00:00:00 UTC2012-03-26 00:00:00 UTC202
Mar 262012-03-26 00:00:00 UTC2012-04-02 00:00:00 UTC000
Apr 22012-04-02 00:00:00 UTC2012-04-09 00:00:00 UTC000
Apr 92012-04-09 00:00:00 UTC2012-04-16 00:00:00 UTC000
Apr 162012-04-16 00:00:00 UTC2012-04-23 00:00:00 UTC000
Apr 232012-04-23 00:00:00 UTC2012-04-30 00:00:00 UTC000
Apr 302012-04-30 00:00:00 UTC2012-05-07 00:00:00 UTC000
May 72012-05-07 00:00:00 UTC2012-05-14 00:00:00 UTC000
May 142012-05-14 00:00:00 UTC2012-05-21 00:00:00 UTC000
May 212012-05-21 00:00:00 UTC2012-05-28 00:00:00 UTC101

What Hacker News says

3 sources
> ... and when we look at the um... "old" fart Java... their roster is even more impressive: LinkedIN, Google, NetFlix, Amazon. Sure it is. But I won't use Java for web stuff. I might use it for some background services, but for regular CRUD functionality, Java buys me nothing. I generally use Python(Flask)/Jinja2/Flask-SqlAlchemy. Flask is intuitive; Jinja2 is pleasant and fast; Flask-SQLAlchemy is concise with the option of exploring the raw power of SQLAlchemy. For regular use cases, nothing in Java beats this combination. I have looked at Play; it comes closer but it's still not there. Checkout this toy benchmark that was doing the rounds 2 months ago https://github.com/grahamking/Key-Value-Polyglot The naive python solution https://github.com/grahamking/Key-Value-Polyglot/blob/master... performs dog slow. Java has real threads, JIT;
Read the rest
but guess what, the naive Java solution still is dog slow https://github.com/grahamking/Key-Value-Polyglot/blob/master... My specialized python solutions are magnitudes of times faster than both naive Python and Java solutions: https://github.com/rahulkmr/Key-Value-Polyglot/blob/master/m... https://github.com/rahulkmr/Key-Value-Polyglot/blob/master/m... The naive solutions were taking around 20 seconds to do 500 writes followed by 500 reads. My changed solution does 5000 writes followed by 5000 reads in under 2 seconds. The 500 and 5000 aren't typos - the naive solutions was taking about 20 seconds for 1000 operations, whereas tailored solution was doing 10000 operations under 2 seconds. This is the discussion thread http://news.ycombinator.com/item?id=3733090 I get it that this is an IO bound problem, and naturally an epoll based solution will totally smoke a thread-per-request solution, but that's the point I am trying to make. If at the end of the day, intuitive solutions don't work and I have to do custom implementations, I am not getting much out of using Java. I might use it for something which is CPU bound about 70% of the time, but anything other than that, the pains far outweigh benefits.
In Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB
I'm the author of the original post. The difference has nothing to do with epoll, these comments are correct. Thanks particularly to codeape for his pull request which made me realise this. Sorry everyone. I will fix the post. Reducing the number of send calls, in both the C and Python versions, makes them enormously faster. Go is already batching up the writes, hence the apparent speed advantage. If you strace the client, you see that the "get" case was replying with two send calls, one for the "VALUE" line, another with the value and "END". All the time is consumed with the client waiting to receive that second message. Depending on the client, and I tried a bunch of ways, it's either in 'poll' (pylibmc), 'futex' (Go), or 'recv' (basic python socket). That second receive is about two orders of magnitude slower than the previous recv. Wh
Read the rest
y does reading that second line take so much longer? There's more detail here: https://github.com/grahamking/Key-Value-Polyglot/pull/5#issu...
In In-memory key-value store in C, Go and Python
Looking at the go version[1] I am not sure if will work as expected. Maps in go are not thread safe.[2] So it could be the go version is out performing the others do to the lack of synchronisation. There are several ways to fix this in go, the easiest might just be to use a mutex around the accesses to the cache. But it would probably be better to use a readers writers lock. edit: (that said I am not sure if the C version is thread safe either I haven't read the docs for the hash table he is using.) edit 2: (looks like the C version is not thread safe either). [1] https://github.com/grahamking/Key-Value-Polyglot/blob/master... [2] http://golang.org/doc/go_faq.html#atomic_maps
In In-memory key-value store in C, Go and Python

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.