This is talk about managing concurrent workloads; how to identify work that can be parallelized, and the best strategies to use to get the most out of the resources available to you.
concurrent workloads; how to identify work that can be parallelized, and the best strategies to use. It’s all about maximizing the use of your resources (or even better, someone else’s resources). Image source: mahbubzaman on Instagram
amounts of RAM. But our Ruby applications are often not making the most of these resources, being single threaded by default. Not only that, but the resources that we interact will be subject to various bottlenecks, bottlenecks that can often be circumvented by using concurrent programming techniques.
a stack, heap, file handles, child processes, and a thread*. Threads Belong to a process. Will share the address space with other threads in the same process.
or by explicitly starting a subprocess with backticks, exec, system, etc. When using fork, the entire process will be duplicated. Memory, file handles and all. Will almost certainly be running in parallel. Threads Threads can be started using the Thread gem (part of the stdlib), or with a number of other thread related libraries. When using threads, you must take care of race conditions, and try to use “thread-safe” libraries*. Watch out for the GIL. Threads will probably not be running in parallel, but often that doesn’t matter. No point doing CPU bound problems with MRI