Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

tldr;

Increasing throughput doesn't mean faster, it means more efficient use of your resources.

Asynchronous and parallelizing workloads only increases throughput not speed. You get more done faster, you don't get each thing produced faster..er.

---

Async is only faster if you're not CPU constrained. I don't think anyone is surprised.

The following is really simplified; but, hopefully this makes things more clear for folks...

Assuming ONE cpu, with ONE thread

Synchronous call:

[A: Start]---------------->[B: Finish]

Asynchronous call:

[A: Start]-------->[B: Pause]...(sleep)...[C: Resume]----->[D: Finish]

There is no way to make the async call faster than the synchronous call, period. By simply having the operation pause/wait/resume (context switch) it has introduced overhead that is not present in the synchronous operation.

So WTF async?

Async is only useful when the context switching overhead is less than the time the I/O operation takes. That's it... So when you have I/O bound tasks, that take more time than it does to switch contexts (and carefully manage how many context you have), you can have increased _throughput_.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: