Re: [Catalyst] Restarting Catalyst on request or doing something per request
On Mon, Aug 24, 2009 at 3:51 PM, Matthias Dietrich mdietr...@cpan.orgwrote: Hi Chris, Am 24.08.2009 um 04:43 schrieb Chris: Can you use catalyst::plugin::cache as the backend for the lexicon? Then refreshing the texts involves clearing the cache, and updates are transparent. I took a quick look at C::P::Cache and I don't think it is possible to use this module as the backend with adequate work. Locale::Maketext::Lexicon stores the text somewhere under its own package name in a hash. To use a cache backend here would mean creating a module around L::M::L which alters internal data whereas this new module would depend on the current L::M::L module version. I don't think this would be good. So from my point of view the best way would be to reload the lexicon data once it has changed. As this is not possible without manually restarting apache, this leads me to reloading the lexicon after the database contents has changed within each apache client on request start (before any lexicon text is requested). I could initiate this within an auto sub in Root.pm, but this seems very ugly. I guess a new plugin (like C::P::I18N::DBI::Reloader) would be good. What do you think? Why cant you just do a: # ... incrementally add new lexicons Locale::Maketext::Lexicon-import({ de = [Gettext = 'local/hello/de.po'], }) ... on change instead of reloading apache? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Restarting Catalyst on request or doing something per request
Hi Wade, Am 25.08.2009 um 13:48 schrieb Wade Stuart: Why cant you just do a: # ... incrementally add new lexicons Locale::Maketext::Lexicon-import({ de = [Gettext = 'local/hello/de.po'], }) ... on change instead of reloading apache? because this would only affect the current apache child process (at least under mod_perl). All other clients will still have the old lexicon. Thanks, matt -- rainboxx Matthias Dietrich Freier Software Engineer rainboxx | Tel.: +49 (0) 151 / 50 60 78 64 Tölzer Str. 19| Mail: m...@rainboxx.de 70372 Stuttgart | WWW : http://www.rainboxx.de XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html PGP.sig Description: Signierter Teil der Nachricht ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Restarting Catalyst on request or doing something per request
Hi Chris, Am 25.08.2009 um 00:48 schrieb Chris: I wonder if you could force a reload using a SIG{USR1} handler and avoid a per-request check? I think so, but I need to know the processes to send the signal to. I guess $$ is only the current apache client process and a signal to this will not get to the others. What about sending a signal to the parent process -- will this affect the childs? If yes, how can I determine the PID of the parent from within a child process? As I already said I'm not familiar with FastCGI and I don't yet know about how clients are spawn and if they might share their memory. Maybe someone here knows about this? Thanks, matt -- rainboxx Matthias Dietrich Freier Software Engineer rainboxx | Tel.: +49 (0) 151 / 50 60 78 64 Tölzer Str. 19| Mail: m...@rainboxx.de 70372 Stuttgart | WWW : http://www.rainboxx.de XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html PGP.sig Description: Signierter Teil der Nachricht ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Restarting Catalyst on request or doing something per request
On 25 Aug 2009, at 16:57, Matthias Dietrich wrote: Hi Wade, Am 25.08.2009 um 13:48 schrieb Wade Stuart: Why cant you just do a: # ... incrementally add new lexicons Locale::Maketext::Lexicon-import({ de = [Gettext = 'local/hello/de.po'], }) ... on change instead of reloading apache? because this would only affect the current apache child process (at least under mod_perl). All other clients will still have the old lexicon. Right - so use some form of caching scheme to save a lexicon 'generation' key. Bump the value of that key when the lexicon is changed. The first time you use the lexicon in a hit (or just at the start of the hit), check the lexicon generation and reload if needed? This approach is simpler than futzing around with process management, simpler than messing with multiple signals, simpler to scale to n boxen (just use memcache - can change this by config if you're using Catalyst::Plugin::Cache), etc... Cheers t0m ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Restarting Catalyst on request or doing something per request
Hi Chris, Am 24.08.2009 um 04:43 schrieb Chris: Can you use catalyst::plugin::cache as the backend for the lexicon? Then refreshing the texts involves clearing the cache, and updates are transparent. I'll have a look at C::P::Cache, but as I use Maketext::Lexikon the cache has to work with that. But your description on refreshing sounds lik a good way :-). Thanks, matt -- rainboxx Matthias Dietrich Freier Software Engineer rainboxx | Tel.: +49 (0) 151 / 50 60 78 64 Tölzer Str. 19| Mail: m...@rainboxx.de 70372 Stuttgart | WWW : http://www.rainboxx.de XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html -- rainboxx Matthias Dietrich Freier Software Engineer rainboxx | Tel.: +49 (0) 151 / 50 60 78 64 Tölzer Str. 19| Mail: m...@rainboxx.de 70372 Stuttgart | WWW : http://www.rainboxx.de XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html PGP.sig Description: Signierter Teil der Nachricht ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Restarting Catalyst on request or doing something per request
Hi Chris, Am 24.08.2009 um 04:43 schrieb Chris: Can you use catalyst::plugin::cache as the backend for the lexicon? Then refreshing the texts involves clearing the cache, and updates are transparent. I took a quick look at C::P::Cache and I don't think it is possible to use this module as the backend with adequate work. Locale::Maketext::Lexicon stores the text somewhere under its own package name in a hash. To use a cache backend here would mean creating a module around L::M::L which alters internal data whereas this new module would depend on the current L::M::L module version. I don't think this would be good. So from my point of view the best way would be to reload the lexicon data once it has changed. As this is not possible without manually restarting apache, this leads me to reloading the lexicon after the database contents has changed within each apache client on request start (before any lexicon text is requested). I could initiate this within an auto sub in Root.pm, but this seems very ugly. I guess a new plugin (like C::P::I18N::DBI::Reloader) would be good. What do you think? Thanks for your help, matt -- rainboxx Matthias Dietrich Freier Software Engineer rainboxx | Tel.: +49 (0) 151 / 50 60 78 64 Tölzer Str. 19| Mail: m...@rainboxx.de 70372 Stuttgart | WWW : http://www.rainboxx.de XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html PGP.sig Description: Signierter Teil der Nachricht ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Restarting Catalyst on request or doing something per request
So from my point of view the best way would be to reload the lexicon data once it has changed. As this is not possible without manually restarting apache, this leads me to reloading the lexicon after the database contents has changed within each apache client on request start (before any lexicon text is requested). I could initiate this within an auto sub in Root.pm, but this seems very ugly. I guess a new plugin (like C::P::I18N::DBI::Reloader) would be good. What do you think? You're facing the overhead of checking for text changes on each request, so a plugin hooking early in the request sounds effective. I wonder if you could force a reload using a SIG{USR1} handler and avoid a per-request check? Good luck with it. - Chris ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Restarting Catalyst on request or doing something per request
Hi, I'm using the plugin C::P::I18N::DBI (which is from me) which loads the texts from database once on application startup. Now in my app I'm building an admin panel where one can edit the texts. After the admin finishes editing, he currently needs to restart the whole apache to load the new texts into catalyst or has to wait until the apache clients are killed after time (if running under mod_perl). This may be ok for develping but when running in production with several other website on the same apache, this is not a good idea. I thought there may be a possibility to restart only the catalyst application (like the built-in server does), but I don't think this is possible with apache. So the solution would be to set a lexicon last modified date somewhere and update this every time the texts have changed (which will not be often). The app could then check at each (or each N requests?) if the date has changed and reload the data. Would this be a good scenario and where exactly could this checking be done? When running under mod_perl (what the production apps currently do), the reloading has to be done for each client. I don't know how FastCGI is working with that, but I'm considering using FastCGI for production. Thanks, matt -- rainboxx Matthias Dietrich Freier Software Engineer rainboxx | Tel.: +49 (0) 151 / 50 60 78 64 Tölzer Str. 19| Mail: m...@rainboxx.de 70372 Stuttgart | WWW : http://www.rainboxx.de XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html PGP.sig Description: Signierter Teil der Nachricht ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Restarting Catalyst on request or doing something per request
Hi Matt, On Mon, Aug 24, 2009 at 6:10 AM, Matthias Dietrichmdietr...@cpan.org wrote: Hi, I'm using the plugin C::P::I18N::DBI (which is from me) which loads the texts from database once on application startup. Now in my app I'm building an admin panel where one can edit the texts. After the admin finishes editing, he currently needs to restart the whole apache to load the new texts into catalyst or has to wait until the apache clients are killed after time (if running under mod_perl). This may be ok for develping but when running in production with several other website on the same apache, this is not a good idea. I thought there may be a possibility to restart only the catalyst application (like the built-in server does), but I don't think this is possible with apache. So the solution would be to set a lexicon last modified date somewhere and update this every time the texts have changed (which will not be often). The app could then check at each (or each N requests?) if the date has changed and reload the data. Would this be a good scenario and where exactly could this checking be done? Can you use catalyst::plugin::cache as the backend for the lexicon? Then refreshing the texts involves clearing the cache, and updates are transparent. - Chris ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/