What happens when I save a Pharo image while serving HTTP requests?

The Seaside book says: "Saving [images] when processing HTTP requests is a risk you want to avoid."

Why is this? Does it just temporarily slow down the service of HTTP requests or will requests be lost or errors occur?

+4
source share
2 answers

Before saving the image, registered shutdown actions are performed. This means that the source files are closed and the web servers are down. After saving the image, it performs startup actions, which usually call the web server again. Open connections may be closed depending on the server implementation.

This means that you cannot accept new connections while you save the image, and open connections may temporarily pause or close. For both questions, there are (at least) two simple workarounds:

  • Close the image using OSProcess before saving it (DabbleDB, CmsBox).

  • Use multiple images and a load balancer so that you can delete images from active servers at the same time before saving them.

+3
source

It seems that this is just a matter of moderation. There is this rather detailed stream in the Primorsky list, the most appropriate position of which is this study of the e-commerce site:

Therefore, this is currently happening:

  • the image is saved from time to time (usually daily) and copied to a separate "backup" computer.
  • if something is bad, the last image is captured, and orders and / or gift certificates issued since the last time the image was saved are simply re-entered.

And, # 2 was very rarely done - maybe two or three times a year, and then it turns out that this is usually because I did something stupid.

In addition, one of the great features of Smalltalk is that it is so easy to run quick experiments. You can load Seaside and stop at the callback of one of the examples. For instance:

WACounter>>renderContentOn: html ... html anchor callback: [ self halt. self increase ]; with: '++'. ... 
  • Open a browser on a Seaside server (port 8080 by default)
  • Click "Counter" to go to the sample application
  • Click the "++" link
  • Return to Primorye. You will see a pre-debug window to stop
  • Save image
  • Click "Continue". You will see that the counter increases correctly, without any visible effect from saving.
+3
source

All Articles