[Vienna-pm] persistant counter

Jozef Kutej jozef at kutej.net
Thu Apr 23 00:27:44 PDT 2009


peter pilsl wrote:
> Ein forked process (mit bis zu 200 instanzen) erledigt parallel gewisse
> aufgaben und soll darüber "buch führen". Für jede Aufgabe soll ein Zähler
> erhöht werden, wobei es ungefähr 20 Arten von Aufgaben, also 20 Zähler gibt.

what about redesigning the program and switching to event model. i'm assuming
(...) that you are not making 200 disk-writes or cpu intensive computation on a
single machine, as you will most likely kill it. my guess is, it's some parallel
network thing (???) and the 200 processes are "bored" most of the time. this is
good task for something like http://search.cpan.org/perldoc?AnyEvent and
friends. you will have just one process and the events will be triggered when
there are some IO events. if you would like to process in parallel (on more
cpu-s or machines), you run in N-times and set-up a timer event that will, once
in a while ;) update the counter in the database. so the updates will be
accumulate - ex. 4 processes with one update a second will be manageable for any
database.

regards,
jozef


More information about the Vienna-pm mailing list