On my nodejs/express webserver for a website that displays statistical data, I have to do things like:Preparing data for Chart.js: Node-pg returns data as rows, so I have to convert row data to pure column value data series (like [23,54,34,53,77,29,45]) by iterating over row data and creating a new array that I can feed Chart.js.Server-side rendering for webpages: iterate over data arrays and populate unordered lists in HTML.I can't see how I could easily offload these operations, and I guess any webserver does have to do some number crunching. But even though the operations are super quick, the webserver is technically blocked for a very short period since Node is single threaded.I'm a pretty new developer, but should I be worried about having loops in a Node webserver? Is Node a bad choice for a webserver that does this kind of thing, or am I worrying over something that doesn't really pose a problem in practice?
Submitted May 21, 2020 at 04:21PM by apartmenthunterbkk
No comments:
Post a Comment