[Serdev] SER-wide IPC/RPC, how?
Jan Janak
jan at iptel.org
Fri May 28 17:17:47 UTC 2004
On 28-05 14:12, Maxim Sobolev wrote:
> Folks,
>
> We are currently investigating possibility to enhance database support
> in usrloc module to make it more robust. The idea is that when the
> database goes down for some reason, ser should be able to detect it and
> switch automatically to memory-only mode. When in this mode it should
> from time to time try to re-connect to the db. Once the connection is
> restored it syncs in-memory contacts table with that in the db and
> switches back to the previous mode.
>
> Unfortunately current architecture makes almost impossible to do it
> correctly since both timer thread and listening threads perform database
> operations. My plan is to restructure the code somehow, so that only
> timer thread is allowed to perform db operations, which would require
> some way in which listening threads can "wake up" timer thread and ask
> it to insert or update specific contact. This brings up question in the
> subject: is there any existing way for the listening thread to perform
> remote procedure call or queue task for the timer thread and wake it up?
> I guess that it can be done using shared memory and semaphores, just
> wonder if there any existing APIs that can be re-used or similar code,
> so that I will not be re-inventing the wheel.
>
> Any ideas or suggestions are highly appreciated.
This is how does it work with db_mode 2 of usrloc module with one
exception: if database update fails due to some reason, ser does not
try to update the same data again, although it is still kept in memory
intact. Database reconnections should be handled transparently by the
underlying database library (mysql client lib in most cases), but I
have some doubts about the reconnecting part because some people
already reported that it did not happen for them, I will have to
re-check this.
Making usrloc to re-try failed updates should be easy to do (althought
it requires some changes to usrloc).
Listening threads access the database in db_mode 1 only, in db_mode 2
all database operations are performed by a timer.
Is that what you are looking for ?
Jan.
More information about the Serdev
mailing list