luckyframework/lucky

Multi-thread support

notramo opened this issue ยท 4 comments

Crystal has multi-thread support. Is it possible to enable it for the server executable?

I actually haven't played with the multithreading yet because it's still behind a preview flag, so I've been treating that like an experimental feature. It would be cool if Lucky ran with the multithread support, but I haven't tried it out yet.

Does it require lot of work?

I have no clue, to be honest ๐Ÿคทโ€โ™‚๏ธ I've never used multithreading, so I'm not sure if it works, or if it doesn't and what it would take to make it work.

For extra performance, I'm currently using https://github.com/jwoertink/lucky-cluster so I can boot multiple instances on the same server. Instead of using 1 server with multi thread, I'm using 8 servers with single thread ๐Ÿ˜†

I see this question get brought up on the Crystal forum sometimes, and it usually comes down to: Yes, it's supported, but it's behind a preview flag, because they're not confident the standard library will run with it well, since it was not designed for multithreading.

I don't think this will get much attention until Crystal enables it completely, and they have at least run it through it's paces with the standard library.

In the meantime, you can always horizontally scale, which is usually a better approach in practice.