News for hackers. Stuff that matters.
Re:Why Wasn't Ruby 3 Faster? by chmod775 on Wednesday February 10, 2021 @11:16PM (#26098201)
I think you have missed where he said it had 20 people using it.

Not 200,000. A single process wasn't able to handle 20.

You'll be hard pressed intentionally writing code that performs that slowly in a framework in another language.

Ruby by default has an incredibly long list of "you can but you shouldn't" and things you need to be aware of, especially around concurrency.

Other languages are mostly fast by default. When you follow some nodejs/express/whatever introduction tutorial and implement your first application in the most naive way possible, you'll end up with something that will easily scale to hundreds if not thousands of users out of the box.

Do the same with ruby (or even with some python frameworks, to be fair), and stuff can break at less than a hundred users.

And that's why yes, you can blame that on ruby. Or at least ruby how it is commonly taught.

Re:Why Wasn't Ruby 3 Faster? by jacobsenscott on Thursday February 11, 2021 @02:01AM (#26099002)
There's nothing about the code being slow in the example. The example said the processes were io bound. The speed of ruby code is irrelevant. If it was io bound demo system had 2 processes sitting 99% idle.

The example said there was 0.5 seconds of IO per request so each process could serve 2 requests per second. 2 processes would serve 4 requests per second. The mistake was running only one process per core. 10 processes would server 40 requests per second, and the cores would still be mostly idle. With rails you always run as many processes as memory allows, not one per core.

Now that rails is thread safe you can have each process run a few threads. If you ran 10 processes and 4 threads per process you are up to 120 requests per second.

If you really need massive concurrency that isn't anything special. But that is more than enough for 90% of the web apps out there.

Re:Why Wasn't Ruby 3 Faster? by the-dude on Thursday February 11, 2021 @04:40AM (#26099789)
This is nonsense, there is boatloads of frameworks and CMSes which can easily run into the 10s or 100s of milliseconds for the main request ( WP for example ).

Serving only 20 users only has to do with how many workers were assigned.

I actually implemented a high traffic RoR payment provider on minimal infra ( 1 small VPS ), and benchmarked a couple of Python CMSes and compared them to WP.

Re:Why Wasn't Ruby 3 Faster? by michaelcampbell on Thursday February 11, 2021 @08:43AM (#26101396)
> I actually implemented a high traffic RoR payment provider on minimal infra ( 1 small VPS ), and benchmarked a couple of Python CMSes and compared them to WP.

I'd like to see your results if you still have them.

Re:Why Wasn't Ruby 3 Faster? by ketamine__ on Wednesday February 10, 2021 @11:43PM (#26098326)
There is a lot we don't know with the example given. It's unfair to blame Ruby.
Re:Why Wasn't Ruby 3 Faster? by lostcolony on Thursday February 11, 2021 @12:07AM (#26098435)
But it's not unique to this example. It's common; if you don't start out concerned about concurrency in Ruby, and just do the naive thing, you are going to fall over at -extremely- low numbers compared with most other modern languages.
Re:Why Wasn't Ruby 3 Faster? by the-dude on Thursday February 11, 2021 @06:39AM (#26100464)
If it is so common as you claim, could you point us to some public examples of this?

I have never ever been concerned about concurrency in Ruby, or Python or PHP. Just deployed the number of workers which would be able to serve our peaks.

I do write high concurrency application though, but those are not web apps and are not written in these languages.

Re:Why Wasn't Ruby 3 Faster? by jmcgough on Thursday February 11, 2021 @06:56AM (#26100564)
I've used Ruby and rails for close to a decade and have never seen/experienced something like what they're describing, so I doubt this is really that common.
Re:Why Wasn't Ruby 3 Faster? by debaserab2 on Thursday February 11, 2021 @03:31AM (#26099461)
The "naive" thing in Ruby, if you're serving HTTP requests, is to use some kind of app gateway that allows concurrency, such as puma or unicorn. It's just not all that viable to do something more basic than that unless you're willing to write all the request handling stuff by hand.

That aside, a ruby script that can't handle 20 req/s on 2 vcpus seems rather suspect. I'd be really curious what that code looked like. I'm doubtful that it has much to do with the language and not the code design.