I'm using PHP to pull financial data from yahoo. Then I'm sending the data in JSON format to one of my Typepad blogs and receiving it with JavaScript.
Is it faster to process the data on the server-side, then send the JSON subset to JavaScript. Or would it be better to send the whole thing, then process it with JavaScript on the client side?
How do I learn how to make this type of trade-off analysis on my own?
Client-side means that the processing takes place on the user's computer. It requires browsers to run the scripts on the client machine without involving any processing on the server. Server-side means that the processing takes place on a web server.
In general, if you have lots and lots of data, maybe several thousands or millions of rows, it is better to perform processing on the server instead of the client. For example if paging and sorting are processed on the server, we only need to send a few rows (10, 15, 20 or may be 100).
Between the two options, server-side rendering is better for SEO than client-side rendering. This is because server-side rendering can speed up page load times, which not only improves the user experience, but can help your site rank better in Google search results.
Server-side processing happens when a page is first requested and when pages are posted back to the server. Examples of server-side processing are user validation, saving and retrieving data, and navigating to other pages.
Mostly good estimating. Sending large amounts of data to the client for processing will incur client overhead and make their browsing experience less acceptable. Processing data server side will increase your server load per client.
This is a common situation seen with large tables of data that are sortable or paginated. You can either do that entirely in browser or enable server side sorting and paignation. My rule of thumb is if I have more then 10k cells (10 columns x 1000 rows) then I should probably enable server side processing instead of leaving it up to the client. This is especially true on older machines with shitty slow JavaScript engines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With