madoctopus
Supreme Member
- Apr 4, 2010
- 1,388
- 3,709
@jazzc
I looked into Gearman. I even built my custom process management and did it in a multi-process way. The problem in this case is you end up using massive amounts of RAM. For example I built this multiprocess crawler and i spawned 150 processes. That eat up about 2GB RAM considering it was a very slim script. CPU load was initially the bottleneck, but after I optimized my language detection function I went from a load of 2 to 0.2 on a 2-core. However I was still using 2GB RAM. In order to max out usage on a 100mbps dedicated line I would need to spawn about 3 times as much, increasing server cost. Personally I prefer to optimize my scripts than pay more for hardware. Over time it proves to be a better design decision than upgrading hardware.
If the particular script would be more CPU or I/O intensive, then I wouldn't bother trying to over optimize RAM consumption. However, think about this situation. Let's say I want to do a proxy tester. I have let's say 500k proxies in the table and I want to test them at a rate of 400 in parallel. The bandwidth used is quite slim since I am only returning about 1KB of data per request. However, since I would be running 400 processes it would eat up a lot of RAM.
I looked into Gearman. I even built my custom process management and did it in a multi-process way. The problem in this case is you end up using massive amounts of RAM. For example I built this multiprocess crawler and i spawned 150 processes. That eat up about 2GB RAM considering it was a very slim script. CPU load was initially the bottleneck, but after I optimized my language detection function I went from a load of 2 to 0.2 on a 2-core. However I was still using 2GB RAM. In order to max out usage on a 100mbps dedicated line I would need to spawn about 3 times as much, increasing server cost. Personally I prefer to optimize my scripts than pay more for hardware. Over time it proves to be a better design decision than upgrading hardware.
If the particular script would be more CPU or I/O intensive, then I wouldn't bother trying to over optimize RAM consumption. However, think about this situation. Let's say I want to do a proxy tester. I have let's say 500k proxies in the table and I want to test them at a rate of 400 in parallel. The bandwidth used is quite slim since I am only returning about 1KB of data per request. However, since I would be running 400 processes it would eat up a lot of RAM.