librelist archives

« back to archive

New Global Settings Feature Available

New Global Settings Feature Available

From:
Zed A. Shaw
Date:
2010-07-24 @ 19:40
Hi Everyone,

We've been heavily hacking on the Mongrel2 and I just put up a little
settings feature that I thought I'd talk about.  Basically the config
database now has a big key=value table called "setting" that will be
used to set global configuration stuff.  The only setting available
right now is "zeromq.threads", which lets you set the initial number of
threads devoted to 0MQ.

You can now set this in the config by passing in a settings parameter
and a dict in the Python config, like this from the
examples/python/tests/mongrel2_org.py file:

  ....
  main.hosts = [mongrel2]
  
  settings = {"zeromq.threads": 4}
  
  commit([main], settings=settings)

Which then adds those settings to the database, and in this case says to
use 4 threads.

All settings will have a reasonable default so that if you don't have
one, then it's not a catastrophe waiting to happen.  In the case of this
setting it's 2 threads.

Incidentally, if you're on multiple cores this is how you get more out
of a Mongrel2 server.  Just jack up the 0MQ threads so that you start
maxing out your CPUs shuttling messages around and that takes the load
off the main HTTP thread.

-- 
Zed A. Shaw
http://zedshaw.com/