ibmruntimes / yieldable-json

Asynchronous JSON parser and stringify APIs that make use of generator patterns
Other
145 stars 22 forks source link

Performance Question #5

Closed tcf909 closed 5 years ago

tcf909 commented 6 years ago

Hello,

You mentioned loop starvation in the README, but what about general performance (time to completion)? How does this library compare to raw JSON functions?

Appreciate the work. It's definitely an interesting project.

gireeshpunathil commented 6 years ago

@tcf909 - thanks for asking the most relevant question on this work.

The principle of yieldable-json is to make event loop free from throttles leading to improved concurrency. When massive JSON data comes in the workload, computation is initiated in proportion to the volume of data, and the loop starvation surfaces. Depending on the socket timeouts, listen backlog settings etc. response to concurrent client requests can either delayed or be denied.

What happens to the yielded JSON computation? those suffer. As we are stealing time from their work area and addressing other work in between, the performance of JSON work will be degraded - the degration being a function of level of concurrency in the system, the volume of JSON data at hand, and the tunable intensity (how do you want the work chopping be conducted)

For this matter, if the workload is purely JSON bound, I wont see any point on using this module, as the additional churn that is required for switching between tasks may offset any benefit that comes of out it. On the other hand, if the workload is a mixture of heterogenous tasks (lot of I/O with JSON intermix - that we see a lot in the Cloud deployments) this proves to be highly beneficial to the overall performance of the webapp.

Hope this exaplanation helps!

gireeshpunathil commented 5 years ago

closing as answered, please let me know if you have additional questions / clarifications.