简体   繁体   中英

testing to see how many instances of ruby script i can run

is it true that it is better to run multiple instances of ruby scripts than doing multiple threads for ruby < 1.9 ?

I would like some tools or approaches to measure how much bandwith, cpu, memory is being used by each instances of ruby script (ex. a web spider).

The goal here is trying to see the maximum number of ruby scripts that can run on my ubuntu web server. Multiple users will be running the script.

basically i have an app which can launch multiple instances of ruby script. multiple users use this app. so i need to figure out a threshold.

It's good to use forking if you are on Unix. As an additional benefit the OS will paralellize the separate Ruby processes for you and you don't have to think about memory usage (because every worker fork will be killed after it completes). To gauge the requirements do a smoke test (how many instances you can boot in active state at the same time).

In terms of RAM the requirement per worker will be equal to the weight of your app environment or, if you use REE with copy-on-write patches applied, sensibly less (since the workers will use the base environment of the parent process).

Threads are a no-go if you want any kind of reliability. The "tools-approaches" is benchmark.rb.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM