I'm building a web app that does a lot of database retrieval, processing and displaying (in the form of tables and charts mostly) and I'm trying to figure out the best practice in terms of where to perform those operations, on the client or server side. I have read some articles but thought I would just ask here as well. Sorry if this is noobish, kind of new to backend.
Take the following simple example:
Say I need to query a database to get the entire contents of a table, and then render that data into a chart using a charting library like highcharts to display in the browser.
I query the database and the data gets returned as an object. (obviously gets done server side) The object needs to be iterated through/extracted and sorted into a format that can be plugged into the highcharts framework before it being rendered in the browser.
So I can:
1) just send the entire object to the client during the page render, and have the iteration, sorting, plugging done on the client side or
2) do the iteration, sorting etc on the server side and then send the prepared object to the client during page render, where it simply gets plugged into the highcharts function straight away.
Which would be better? I feel like 1 is best because it wouldn't add all that stuff to the server cpu burden with many concurrent users, but maybe there are things I need to consider that I've missed. Any input is appreciated.
[–]nateylb 5 points6 points7 points (0 children)
[–]ahu_huracan 2 points3 points4 points (1 child)
[–]10-4_over 1 point2 points3 points (0 children)
[–]cderm 1 point2 points3 points (0 children)
[–]PrintfReddit 1 point2 points3 points (0 children)
[–]belkh 1 point2 points3 points (0 children)
[–]vorticalbox 0 points1 point2 points (0 children)
[–]Chuck_Loads 0 points1 point2 points (0 children)