Closed mudrz closed 3 years ago
added some implementation, but it would be great if you could take a look if it makes sense: https://github.com/TechEmpower/FrameworkBenchmarks/pull/6163/files
I didin't have a close look, but it seemed fine to me. To me, this should be the job of the tcp server to provide the preforking implementation.
App.run_multicore
that will spawn multiple processes with the Opium app. Let me know if that works for you @mudrz 🙂thanks @tmattio will check it out; fyi the last run of tfb framework benchmarks includes the multi process forking:
opium-fedora-forks
- process forking running on fedora
opium-alpine-forks
- process forking running on alpine
opium-haproxy
- run opium on different ports and use haproxy to distribute the load (tbh performance is so bad, that there's likely something wrong with the config, I'll likely remove these tests)
opium
- single process server
gist - multi process performance is 10x better than single process;
tbh I haven't tried running multi-process servers in prod, usually we run simply multiple instances and use a reverse proxy like nginx/haproxy/envoy to distribute the load
are there any docs to refer to on how to run opium on multiple processes?
for example this httpaf implementation forks the process n times based on
nproc
:https://github.com/TechEmpower/FrameworkBenchmarks/blob/0bd0b6ad86a21cd0c54dc310d522962530a0c91f/frameworks/OCaml/httpaf/httpaf_unix.ml#L156-L174
this has had ~10x performance difference, so wondering what is a good starting step