Best thing I ever learned - probably 15 years ago at this point - is just use the right tool for the job. We're a mobile game company, and we use C, C#, Objective C, Java, Python, Go, Erlang, JavaScript, Lua, and more where they make sense. I love language talk and debates (and hate the language hate) here on HN. But if you're only using a single language in production, you're likely not that big, or more likely have…
I never got those "I am language X developer". It is like "I only do hammers and nails. For drilling ask the guy over there."
Ruby and Elixir: Polyglottin' FTW
11–20 of 24 posts
Re: Ruby and Elixir: Polyglottin' FTW
#12Earlier quoted context omitted.
I never got those "I am language X developer". It is like "I only do hammers and nails. For drilling ask the guy over there."
On the other hand if I want some intricate decorative wood carving, I'm going to seek out a guy who specializes in intricate decorative wood carving, not a guy who says "well I've never done any carving, but I've sawed, drilled and hammered lot of wood in my day and carving is basically the same thing."
Decorative wood carving still requires multiple tools and is akin with something like e.g. distributed systems, not language/ product X.
Re: Ruby and Elixir: Polyglottin' FTW
#13Why are you adding an extra level of abstraction in between Rails and Sidekiq? Why not just have Rails push to redis queue and elixir process finishes the job of sending email or doing what it has to do. Why have Sidekiq run at all? It seems adding multiple layers as such will make it harder to understand, debug and maintain in future. EDIT: Also your example of polling on Redis queue using elixir is very inefficient…
Re: Ruby and Elixir: Polyglottin' FTW
#14Earlier quoted context omitted.
While Ruby and Elixir have quite similar syntax, their underlying run time models are fundamentally very different.
Yes very different model, and you realize that the syntax is not so similar once you really start working with Elixir: you start using constructs that don't belong to procedural languages at all. Similarities don't go much further than def do end (but there are too many do and too many different def in Elixir) and the sensible naming of some Library.functions() to match classes and methods in Ruby's standard library.…
Re: Ruby and Elixir: Polyglottin' FTW
#15Earlier quoted context omitted.
I never got those "I am language X developer". It is like "I only do hammers and nails. For drilling ask the guy over there."
On the other hand if I want some intricate decorative wood carving, I'm going to seek out a guy who specializes in intricate decorative wood carving, not a guy who says "well I've never done any carving, but I've sawed, drilled and hammered lot of wood in my day and carving is basically the same thing."
Re: Ruby and Elixir: Polyglottin' FTW
#16One minor suggestion for the author (post doesn't have a comment section). `:timer.sleep(10)` is explained as "sleep for 10 seconds", but sleep takes millis as an argument (http://www.erlang.org/doc/man/timer.html#sleep-1).
Re: Ruby and Elixir: Polyglottin' FTW
#17Re: Ruby and Elixir: Polyglottin' FTW
#18Why are you adding an extra level of abstraction in between Rails and Sidekiq? Why not just have Rails push to redis queue and elixir process finishes the job of sending email or doing what it has to do. Why have Sidekiq run at all? It seems adding multiple layers as such will make it harder to understand, debug and maintain in future. EDIT: Also your example of polling on Redis queue using elixir is very inefficient…
Redis has blocking list primitives which you can use to build an efficient queue (push and pop in O(1)), if you look at the code you'll see he's using brpop
Re: Ruby and Elixir: Polyglottin' FTW
#19Excuse my poor understanding of Ruby's GIL, but is the need for an Elixir worker because Ruby is by default single-threaded, and therefore actual default concurrent Sidekiq workers are not possible? Or this a problem scaled up to the degree that we're talking ~thousands of jobs per second that Ruby's limitations start to show?
If the job involves an expensive API call it will tie up a worker for the duration of the call.
So it's not so much ~thousands of jobs per second as it is a limitation of only 10 ruby processes per 1GB of memory. (A ruby process with the Rails env loaded is about 100MB.)
Elixir gives you the ability to make a few orders of magnitude more calls in a tiny amount of memory. (100,000 Elixir "workers" can be had in less than 1GB).
Re: Ruby and Elixir: Polyglottin' FTW
#20Excuse my poor understanding of Ruby's GIL, but is the need for an Elixir worker because Ruby is by default single-threaded, and therefore actual default concurrent Sidekiq workers are not possible? Or this a problem scaled up to the degree that we're talking ~thousands of jobs per second that Ruby's limitations start to show?
tl;dr - Sidekiq can do a LOT of work, even on MRI with the GIL.