Re: SMP: process-specific options

From: Tsantilas Christos <chtsanti_at_users.sourceforge.net>
Date: Tue, 23 Feb 2010 10:17:54 -0500 (EST)

> 2010/2/23 Tsantilas Christos <chtsanti_at_users.sourceforge.net>:
>>>
>>> Log rotation will probably need special care to avoid rotating the same
>>> log many times. It is relatively easy to designate one process to do
>>> the
>>> rotation (e.g., squid1), but that alone is not enough to synchronize
>>> everything. Ideally, I would prefer to avoid locking. Any clever tricks
>>> applicable here?
>>
>> Maybe something like the following:
>> - there is a master process
>> - master process communicates with one direction pipes with kids,
>> sending
>> various commands
>>
>> For logs rotation:
>>  - master process closes the old file and rename it
>>  - master process opens a new log file
>>  - kids still writing to the old file (because they did not close the
>> file descriptor yet)
>>  - master process send a command to all kids saying that the log file
>> rotated
>>  - The kids close the log file and reopen it.
>>
>> The above will work at least for unix systems (I do not know about
>> MS-Windows)
>> Master/kids communication using pipes is used by the apache worker
>> server.
>> I am also using it in my icap server. I am not seeing any problem.
>
> Why not just having a log writing helper to whom clients write log
> lines via some kind of sockets?
> That would make the log rotation problem just go away - especially the
> part where there may be race conditions among workers writing together
> to the same file.

Yep, this is what I am proposing in my first mail.
But what I am describing here can be an alternative.
Also you can consider it as an example usage of the parent/kids
communication using pipes. Maybe there are other similar problems.

Regards,
    Christos

>
> --
> /kinkie
>
Received on Tue Feb 23 2010 - 15:18:04 MST

This archive was generated by hypermail 2.2.0 : Tue Feb 23 2010 - 12:00:09 MST