Terminating Child process Dynamically
I would like terminate current sever Child process after the end of current request because some data is cached and data is changed after the process creation. The data cached during InitChild phase Is it possible ? Which phase should i do this -- --Shibi Ns--
Re: Terminating Child process Dynamically
Shibi Ns wrote: I would like terminate current sever Child process after the end of current request because some data is cached and data is changed after the process creation. The data cached during InitChild phase Is it possible ? It is certainly possible (*), but really, really, really inefficient. You are going to force your Apache server to create a new child process for each HTTP request ? That sounds crazy. You should review your application logic instead. (*) The easiest way would be to set MaxRequestsPerChild to 1 in your server configuration. But don't think that I would recommend doing that.
Re: Terminating Child process Dynamically
On Fri, Mar 2, 2012 at 3:20 AM, Shibi Ns shibi...@gmail.com wrote: I would like terminate current sever Child process after the end of current request because some data is cached and data is changed after the process creation. The data cached during InitChild phase Is it possible ? It certainly is! You can use $r--child_terminate(). You might put this in a cleanup handler. You can see example code in Apache2::SizeLimit. However, this isn't what I would do. I would make a cleanup handler that checks somehow to see if the data has changed (stat a file for modtime?) and then reloads the data. It's more efficient than spawning a new process, albeit somewhat more complicated. - Perrin
Re: Terminating Child process Dynamically
Bouncing means restart the application to bring the current changes and new data to the cache. We can't use the following logic as there are huge number of existing data cache and perl modules involved. So the changes will be massive. Shibi On Fri, Mar 2, 2012 at 4:51 PM, André Warnier a...@ice-sa.com wrote: On Fri, Mar 2, 2012 at 3:32 PM, André Warnier a...@ice-sa.com wrote: Shibi Ns wrote: I would like terminate current sever Child process after the end of current request because some data is cached and data is changed after the process creation. The data cached during InitChild phase Is it possible ? It is certainly possible (*), but really, really, really inefficient. You are going to force your Apache server to create a new child process for each HTTP request ? That sounds crazy. You should review your application logic instead. (*) The easiest way would be to set MaxRequestsPerChild to 1 in your server configuration. But don't think that I would recommend doing that. Shibi Ns wrote: Not each request , it's based some data change in database and this could happen couple of times in day that's all. We really don't want to go ahead bounce the application in order refresh the cache I don't now what you mean by bounce the application, but why do you not do something like this : At the beginning of your first handler : our $CACHED_DATA; unless (defined $CACHED_DATA) { $CACHED_DATA = _load_cached_data(); } within the request processing : our $CACHED_DATA; if ($condition) { $CACHED_DATA = undef; } return OK; ... sub _load_cached_data { # load and cache whatever data needs be my $cached_data; ... return $cached_data; } -- --Shibi Ns--
Re: Tool to create multiple requests
Tobias Wagener schrieb am 07.02.2012 um 08:05 (+0100): I'm currently developing a huge application with mod_perl, unixODBC and MaxDB/SAPDB. On my developing system everything is fine. But on the productive system with 50 users, I have database connection errors and request aborts and so on. Now I want to ask if someone knows a tool or perl modules, where I can simulate 50 users. I have a list with some common request including the query parameter in order of appearence. But I don't know, how to send them to my developing system to create the same load as it will be on the productive system. You could spawn many processes using WWW::Mechanize. But I'd rather learn to configure/program a stress tool. Take a look at the following Java tools: * JMeter * Grinder http://www.google.com/search?q=jmeter+grinder This will bring up a couple comparisons that'll help you decide. Michael
Re: Tool to create multiple requests
On Tue, Feb 7, 2012 at 2:05 AM, Tobias Wagener p...@wagener.nu wrote: Now I want to ask if someone knows a tool or perl modules, where I can simulate 50 users. http://www.hpl.hp.com/research/linux/httperf/ It can take a file of URLs to hit in order and it can do MUCH more than 50 users even on cheap hardware. - Perrin
Re: Tool to create multiple requests
On Tue, Feb 7, 2012 at 5:18 AM, James Smith j...@sanger.ac.uk wrote: Apache::DBI sometimes cause issues with too many database connections - we tend to turn it off and use DBIx::Connector as mentioned (and carefully selected caching) here to cope with persistence of connections Can you say more about this? There are sensible arguments that DBIx::Connector is less magical and therefore better from a coder's perspective, but I can't see any obvious reason that persistent connections would be a problem with one and not the other. - Perrin
Re: Terminating Child process Dynamically
On 2 Mar 2012, at 19:04, Shibi Ns wrote: Bouncing means restart the application to bring the current changes and new data to the cache. We can't use the following logic as there are huge number of existing data cache and perl modules involved. So the changes will be massive. Shibi this makes me think your architecture is wrong.