[Seaside] proper way to save image while serving?
David T. Lewis
lewis at mail.msen.com
Thu Apr 9 12:00:25 UTC 2009
On Thu, Apr 09, 2009 at 12:04:58PM +0200, Michal wrote:
> hi David -
> > If you are using a Unix (OS X or Linux) platform, and have OSProcess in
> > your image, then try this:
> > UnixProcess saveImageInBackgroundNicely
> > This will fork a background Squeak to do the image save without locking
> > up your main server image. You'll need to take care that you have enough
> > disk space of course, but otherwise this approach will do the save with
> > no impact at all on your server image.
> Excellent, thank you! Do you have experience loading UnixProcess into
> a running production server under medium/high load? I have a couple
> thousand users relying on that image...
No, I do not. I am not actually running any Seaside server. Definitely
you should test carefully.
I would suggest that you plan for these possible failure modes:
- Out of disk space. Probably your backup process should check in advance
to verify that sufficient space is available(*), but you may also want
to test the effect of trying to do the save with no space available,
just to understand the effect of this kind of failure.
- Backup process fails to complete, and the image never exits. If for any
reason the backup procedure fails to run to completion, such that the
background Squeak process does not exit, you would see an accumulation
of background Squeak processes that will eventually consume too many
- Memory usage. The background Squeak process consumes a very small amount
of memory due (processes share address space after a Unix fork, until
memory is actually modified). However this may not be the case if your
server image is very active and doing garbage collection. Test this and
watch for system memory usage issues when you put this into your production
(*) Here is one way to check free disk space, assuming you have OSProcess
and CommandShell loaded. This example is on a Linux system, and I'm checking
free block count on the file system that Squeak is using:
(ProxyPipeline command: 'df . | tail -1 | cut -c41-50 ')
upToEndOfFile withBlanksTrimmed asInteger
(**) The number of running background processes started by OSProcess is:
(OSProcess thisOSProcess allMyChildren select: [:p | p isRunning]) size
More information about the seaside