Open jwoertink opened 1 year ago
Thanks for catch up @jeremyevans, we definitely need to upgrade codebase.
Could also be great to have some warning on deprecation (I mean using CI or else)
cc @Blacksmoke16 @stakach @ujjwalguptaofficial @drujensen @Sija
@jwoertink @waghanza I made #6558 to test using this approach. I currently use this for a small binary that needs to trigger multiple child processes.
Unfortunately I couldn't get the test suite to run on my local machine because docker-machine
requires VirtualBox which would only install if I wasn't on an M1. I can try playing around with this again later if no one else gets it working.
Could just ignore it, it's only deprecated so not like its going anywhere anytime soon. Maybe by the time Crystal 2.0 comes around, MT support will be better supported and can just leverage that. Might even work already, but haven't did much with it yet. Plus multi process doesn't have the same overhead so iirc gives better perf anyway.
Spider-gazelle already supports non-forked clustering, replacing this line with:
server.cluster(process_count, "-w", "--workers") if process_count != 1
(and threads if built with threading enabled - although then you'd want to disable clustering)
@jwoertink I switched the Amber benchmark to use Process.new
and that appears to be working just fine:
https://github.com/the-benchmarker/web-frameworks/blob/master/crystal/amber/src/amber.cr
As of Crystal 1.8,
Process.fork
is now deprecated https://github.com/crystal-lang/crystal/blob/master/CHANGELOG.md#180-2023-04-14Here's the PR where it was deprecated.
All of the current Crystal frameworks use these lines in order to spin up multiple processes for speed.
https://github.com/the-benchmarker/web-frameworks/blob/f4fb1bc43de8d4ff0dec3dba79569c5b249f6f4e/crystal/lucky/src/lucky.cr#L12-L13
https://github.com/the-benchmarker/web-frameworks/blob/f4fb1bc43de8d4ff0dec3dba79569c5b249f6f4e/crystal/toro/src/toro.cr#L23-L24
Since Crystal 1.8 deprecates this, and Crystal 1.9 could potentially remove it, we may need to find a new way to test all of these.