Installer Gearman sur OSX

installer gearman sur OSX

Prérequis: libevent

S'assurer que la libevent est présente

$ ls -l /usr/local/lib/libevent*

Le cas échéant, l'installer

$ curl -L -O http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz
$ tar -xvzf libevent-1.4.12-stable.tar.gz
$ cd libevent-1.4.12-stable
$ ./configure
$ make
$ sudo make install

Installer libgearman

$ curl -L -O http://launchpad.net/gearmand/trunk/0.9/+download/gearmand-0.9.tar.gz
$ tar -xvzf gearmand-0.9.tar.gz
$ cd gearmand-0.9
$ ./configure
$ make
$ sudo make install

Il installera aussi les 2 applications qui nous intéressent :

/usr/local/bin/gearman
/usr/local/sbin/gearmand

Assurez vous que tous les paths sont accessibles via PATH

$ echo $PATH

si /usr/local/bin ou /usr/local/sbin ne sont pas présent, les rajouter dans le path de l'utilisateur, ou mieux le path général (le fichier /etc/paths)

Commandes utiles

  • lancer gearmand pour la 1re fois

    $ gearmand -vv
     INFO Starting up
     INFO Listening on :::4730 (4)
     INFO Listening on 0.0.0.0:4730 (5)
     INFO Creating wakeup pipe
     INFO Creating IO thread wakeup pipe
     INFO Adding event for listening socket (4)
     INFO Adding event for listening socket (5)
     INFO Adding event for wakeup pipe
     INFO Entering main event loop
    
  • S'assurer que gearmand est entrain de tourner

    $ ps auxw | grep [g]earmand
    xavierbarbosa 21315   0.0  0,0    75664    452 s007  S+    4:57     0:00.00 gearmand -vv
    
  • Vérifier que gearman écoute le port 4730 pour les jobs en TCP

    $ sudo lsof -i tcp:4730
    COMMAND    PID          USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
    gearmand 21315 xavierbarbosa    4u  IPv6 0x6e29258      0t0  TCP *:4730 (LISTEN)
    gearmand 21315 xavierbarbosa    5u  IPv4 0xa243a68      0t0  TCP *:4730 (LISTEN)
    
  • Lancer gearman en mode détaché !

    $ gearmand &
    

Memcached toughts

moxi: memcached + integrated proxy + more

moxi is a memcached proxy with several features which can help keep the memcached contract whole in complicated environments. It also brings several optimizations to memcached deployments, without requiring any changes to the application software using memcached...

http://labs.northscale.com/moxi/

Memcached Functions for MySQL and Moxi: a great combination

Working at Northscale has been a lot of great fun lately! I have finally figured out how to get puppet to set up a stock Amazon instance with everything we need and have been impressed with how you can automate system setup with puppet. I remember when I worked at Grazr how much of a hassle it was for us to have to rebuild systems. Something like Puppet would have been a godsend.

Today I though I would post about how cool moxi is. If you don't know, moxi is a memcached proxy (http://labs.northscale.com/moxi/) which allows you to move any complexity of having to set up the list of memcached servers you are using. Also, moxi has some great features such as:

  • De-duplication of requests for popular keys
  • A front cache, L1 cache to avoid network hops
  • Fire and forget SET (Like an async SET) this means "set a value, but don't wait to know if it was successful"
  • Time-outs for setting the maximum time for operations

This post will show you how moxi can be used with the memcached UDFs for MySQL (https://launchpad.net/memcached-udfs). It's really quite amazingly easy. I'll even thrown in compilation of moxi and setup of moxi...

http://capttofu.livejournal.com/22534.html

FAST POLLING USING C, MEMCACHED, NGINX AND LIBEVENT

In this post I'll show you how to implement really fast polling using C and libevent, memcached and nginx. The performance of the server is over 2400 request pr. second on a not optimized Mac Book - that's 144.000 requests pr. minute.

At Plurk we use polling and we have thousands of live users hammering the service with poll requests. It's beginning to be pretty expensive so I set a goal to optimize it. We currently use this approach in production and it uses around 2% of CPU and very little memory...

http://amix.dk/blog/viewEntry/19414