2011/5/1 Robert Klemme <shortcutter / googlemail.com>: >>> This might be a corner case but I would generally advice to not use >>> global >>> variables (or constants) for this. The reason is simply that you loose a >>> lot of flexibility. You can only ever have one active configuration at a >>> time - and you cannot change it concurrently as well. >> >> Well, I can change it globaly: > > Of course. But you need synchronization to make that thread safe. My code is thread safe (EventMachine with no threads inside) :) >> Anyhow, I don't want to loose flexibility neither mantain ugly code >> (deleting and re-creating constants for each configuration change). >> After this thread I hope that using a constant hash (i.e: >> MyServer::CONFIGURATION) is a good choice between >> ellegancy/flexibility and efficience. > > Is your code loaded once or is it reloaded for every request? The configuration is loaded when starting the server. But I also provide a maangement interface so the admin can reload the configuration in runtime (for example, to change the log level). -- Iaki Baz Castillo <ibc / aliax.net>