Ruby Concurrency Final Report
codeotaku.com
codeotaku.com
- 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?
Processors (and compilers) are not supposed to leak the implications of their non-determinism into user code... but unfortunately it does happen. Rewriting the order of instructions sometimes happens incorrectly (which is why we need memory barriers).
It's not my area, but two things that come to mind, are out-of-order execution where the CPU will re-order micro-ops, and speculative execution, where the CPU will execute one or more branches before the result of a conditional is known.
Both of these issues have lead to bugs in the past and will continue to be a source of bugs in the future.
https://en.wikipedia.org/wiki/Spectre_(security_vulnerabilit...
1) Setup 100-500 sql servers. 2) Artificially increase the amount of time needed to finish connect sequence (> 10 seconds). I have no idea how to do this but it's a likely scenario in my use case of servers on cellular connections. 2) Setup X number of threads to make a connection with TinyTds. 3) Those threads should return immediately but with my testing they did not. Only one connection could be in progress at any given time.
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 outline some of the key improvements in this talk:
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.
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).
"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"?
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.