FAQ
Hi,

So I really wanted to learn Clojure and get familiar with the functional
programming. As a side project I decided
to write a simple data structure server similar to Redis. It uses Redis
protocol and already supports same data structures and main commands.
So any standard redis client can be used to connect to it as well as
standard redis-benchmark tool.

Eventually I'd want to make it fast, distributed and extensible (so you can
easily add any data structures you want). But for
now I'm solving very basic problems while learning the language.

https://github.com/yankov/memobot

Code must be very messy and not idiomatic - I never had experience with
Lisps nor functional programming before. I kept cleaning it up, but figured
it'd be better to try to get feedback first. Would be very grateful if you
guy could point me some obvious weirdness and bad choices in code.

Also some general questions:

1. *How to achieve good throughput?* I run the same benchmarking tool as
for redis and for SET command I get ~200 operations per second (for Redis
it's 30k/sec). To implement a server I used a very simple jboss netty
example without any tweaking. What would be a bottle neck here?

2. What would be a best way to implement sorted sets (like in Redis)? I
used sorted maps and sorting them by values which I highly doubt is a
log(n) operation..

Thanks.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Search Discussions

  • Moritz Ulrich at Sep 18, 2012 at 1:43 pm
    Hi!

    I don't have the time to look at your code right now, but I have one suggestion:

    Artem Yankov writes:
    2. What would be a best way to implement sorted sets (like in Redis)? I
    used sorted maps and sorting them by values which I highly doubt is a
    log(n) operation..
    `clojure.core/sorted-set' and `clojure.core/sorted-set-by'

    http://clojuredocs.org/clojure_core/clojure.core/sorted-set

    --
    Moritz Ulrich
  • Artem Yankov at Sep 19, 2012 at 5:07 pm
    Those are a bit different. Naming of data structures in Redis can be a bit
    confusing. What's called
    a sorted set actually is more like a sorted map - keys mapped to scores and
    set is sorted by scores.
    On Tuesday, September 18, 2012 5:51:25 AM UTC-7, Moritz Ulrich wrote:


    Hi!

    I don't have the time to look at your code right now, but I have one
    suggestion:

    Artem Yankov writes:
    2. What would be a best way to implement sorted sets (like in Redis)? I
    used sorted maps and sorting them by values which I highly doubt is a
    log(n) operation..
    `clojure.core/sorted-set' and `clojure.core/sorted-set-by'

    http://clojuredocs.org/clojure_core/clojure.core/sorted-set

    --
    Moritz Ulrich
    --
    You received this message because you are subscribed to the Google
    Groups "Clojure" group.
    To post to this group, send email to clojure@googlegroups.com
    Note that posts from new members are moderated - please be patient with your first post.
    To unsubscribe from this group, send email to
    clojure+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/clojure?hl=en
  • Artem Yankov at Sep 28, 2012 at 5:41 am
    By the way, i figured performance issue (there was a prn call for each
    command which significantly slowed everything down, heh).
    Now, numbers are close to Redis, except for lrange for big lists and I
    havent' tested zsets yet. Need to gain more experience in jvm tweaking
    and data structure optimization i guess..
    On Wednesday, September 19, 2012 10:01:09 AM UTC-7, Artem Yankov wrote:

    Those are a bit different. Naming of data structures in Redis can be a bit
    confusing. What's called
    a sorted set actually is more like a sorted map - keys mapped to scores
    and set is sorted by scores.
    On Tuesday, September 18, 2012 5:51:25 AM UTC-7, Moritz Ulrich wrote:


    Hi!

    I don't have the time to look at your code right now, but I have one
    suggestion:

    Artem Yankov writes:
    2. What would be a best way to implement sorted sets (like in Redis)? I
    used sorted maps and sorting them by values which I highly doubt is a
    log(n) operation..
    `clojure.core/sorted-set' and `clojure.core/sorted-set-by'

    http://clojuredocs.org/clojure_core/clojure.core/sorted-set

    --
    Moritz Ulrich
    --
    You received this message because you are subscribed to the Google
    Groups "Clojure" group.
    To post to this group, send email to clojure@googlegroups.com
    Note that posts from new members are moderated - please be patient with your first post.
    To unsubscribe from this group, send email to
    clojure+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/clojure?hl=en

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupclojure @
categoriesclojure
postedSep 18, '12 at 11:18a
activeSep 28, '12 at 5:41a
posts4
users2
websiteclojure.org
irc#clojure

2 users in discussion

Artem Yankov: 3 posts Moritz Ulrich: 1 post

People

Translate

site design / logo © 2022 Grokbase