Jin Lim
Jin Lim

Reputation: 2150

Ruby On Rails, and multi threading

I came across that Ruby doesn't really have any performance benefit when you do multi threading. because of GIL nature.

I see there is no point of using multi-threading in Rails app. What is use case of multi-threading in Rails app?

Upvotes: 0

Views: 820

Answers (1)

Mario Saraiva
Mario Saraiva

Reputation: 449

An IO (input/output) operation is one that is not operating on your CPU, such as, reading from a hard drive, an API call to a service, a database operation of some kind.

Anything that is IO heavy would benefit from multi-threading even with GIL. IO operations are blocking in ruby while they wait for the result, so it's only reasonable, while you are waiting for the result of the operation, to want to switch to another thread to do some work.

Upvotes: 0

Related Questions