[squeak-dev] Server timeouts and 504 return codes

Levente Uzonyi leves at caesar.elte.hu
Mon Jan 28 14:22:16 UTC 2019

On Mon, 28 Jan 2019, Tobias Pape wrote:

> Hi,
>> On 28.01.2019, at 03:45, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> […]
>>>> By "the image" I assume you mean the SqueakSource server image.  But
>>>> opening the file takes very little time.  Original web-sites were
>>>> .html files, remember how fast those were?  Plus, filesystems "cache"
>>>> file contents into their own internal caches anyway...
>>> Each file uses one external semaphore, each socket uses three. If you use a default image, there can be no more than 256 external semaphores which is ridiculous for a server, and it'll just grind to a halt when some load arrives. Every time the external semaphore table is full, a GC is triggered to try clear it up via the finalization process.
>>> Reading a file into memory is slow, writing it to a socket is slow.
>>> (Compared to nginx which uses sendfile to let the kernel handle that).
>>> And Squeak can only use a single process to handle everything.
>> That’s configurable.  Alas because writing lock-free table growth is not easy the external semaphore table doesn’t grow automatically.  But the vm does allow its size to be specified in a value cached in the image header and read at startup (IIRC).  So we could easily have a 4K entry external semaphore table.
> […] 
> Eliot, can you give an example invocation so we can add that to the server?

Not Eliot, but you can set it from the image and it's saved in the header. 
However you can't set it anytime, because there is a very slim chance of 
signals being lost during the table update.
I have this in all my built images:

Smalltalk maxExternalSemaphores: 8192.

I guess we should bump the number for the next release so that others 
don't get bitten by this.


> -t

More information about the Squeak-dev mailing list