229 points · by pvsukale3 · 6y ago · 47 comments
- https://github.com/socketry/async "An awesome asynchronous event-driven reactor for Ruby"
- https://github.com/socketry/falcon "A high-performance web server for Ruby, supporting HTTP/1, HTTP/2 and TLS"
I can recommend following him on twitter too: http://twitter.com/ioquatix
Recording yourself writing code and then publishing it takes quite a lot of courage, even moreso if it's a complex topic such as the one presented. Additionally, it's such a valuable resource: You can follow the whole implementation step by step.
That's just awesome.
Thanks for sharing.
nginx is one of the most battle tested code on earth and I don't see a benefit in replacing it with a ruby implementation.
Also why are there a new http server coming out for ruby like every 3 years?
Is it not suitable to just put nginx at front and the app server in the back?
I've been thinking for a while how we could allow individual C extensions to opt in to greater concurrency in TruffleRuby. At the moment we have a single mutex for all C extensions, but maybe we could allow an opt out at compile time so an extension could be built that won't claim that mutex. There's some fiddly details to get right round this though, because I wouldn't want the existence of the opt out to have a negative impact on performance.
I like this article by Herb Sutter "The Trouble With Locks". http://gotw.ca/publications/mill36.htm
I have used multi-(fiber/thread/process) extensively, and at the right place they are useful tools. But by far, threads which share data (especially opaque) are the most tricky to get right. The combinatorial explosion of program states is very hard to deal with in practice and "it works for me" is a very common testing strategy.
I've been dogfooding falcon (https://github.com/socketry/falcon) for the past week, which is built on top of async/Ruby. The HN hug of death + Reddit hug of death is a really great traffic test.
I think actually it's been pretty solid, but something caused the instance to run out of swap space, even though it had plenty of free memory. It's something I'll have to try and reproduce so I can understand how it's happening.
I converted the streaming and Autopark clients in the Tesla API gem from EM to Async and has been great: https://github.com/timdorr/tesla-api/blob/master/lib/tesla_a...
No more globals, which makes it much safer to use inside of threaded job runners like Sidekiq.
I outline some of the key improvements in this talk:
"Nobody is using Ruby for multithreading" is both cause and effect.
That's why I'm not terribly optimistic about projects like this (or the proposed Swift 6). That's not how these things work. Can you imagine a language which features good concurrency support today (like Erlang or Clojure) having been launched without it, and then announcing 5 (or 25) years later "We're going to address concurrency now"?
Even if the background process is I/O intensive (which is supposed to be most of the time waiting, therefore freeing the CPU for the foreground process), it doesn't mean it won't end up still blocking (I've experienced this with filesystem operations).
https://getbootstrap.com/docs/4.0/content/reboot/#native-fon...
Edit: Other than using the magic font names "-apple-system" and "BlinkMacSystemFont" it looks like it's just specifying the Windows, Android and Mac fonts in order. This is not going to use the native system font on other platforms or if the user happens to have Segoe UI installed on Android.