[Pdns-users] pdns recursor - unthreaded vs threaded operation
cmouse at youzen.ext.b2.fi
Fri Dec 30 16:29:26 UTC 2011
On Fri, Dec 30, 2011 at 10:00:50AM +0000, Fabio Sangiovanni wrote:
> Ok I'm kind of a newbie here :)
> My understanding of the problem is:
> if I have 2 threads, running at the same time, both of them executing the same SQL transaction (made up of more select or update queries), how can I predict which one is executed first? It's just like you said: I'd need the whole thing to happen in a single inter-thread transaction :)
> The solution, for now, is limiting Lua sessions to 1 lowering the total number of threads to 1.
> Il giorno 30/dic/2011, alle ore 10:32, Nils Breunese (Lemonbit) ha scritto:
> > Fabio Sangiovanni wrote:
> >> Database transactions help in terms of integrity, but they can do nothing about the order of data updates. If 2 threads work independently and execute the same update query on the db, I can't predict with certainty which one will occur first.
> > AFAIK no updates are committed until the transaction is committed, so all queries within a transaction are guaranteed to happen as if they were one modification to the database. If the order of transactions is important then I think you might need to rethink your logic, because then the whole thing would need to happen in a transaction. I'm not sure what you're trying to do exactly, but it sounds like transactions should be able to help here.
> > Nils.
I can't help wondering if what you are doing is going to look like
UPDATE stats SET counter = counter + 1 WHERE foo = 'bar'
If so, you shouldn't have any issues with concurrency afaik. Running Lua SQL
script in "high traffic site" however is probably not a very good idea due
to aforementioned perfomance issues.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: Digital signature
More information about the Pdns-users