Search code examples
javascriptajaxperformanceclient-sideserver-side

Server side processing or client side processing?


I have developed a comparison website for comparing any product sold online in India. Currently, the site is completely client side :-

  1. Accepts user input.
  2. Makes 20-30 AJAX requests and fetches results from all the major online shops.
  3. Uses some client-side scripting to sort the results and show it in most appropriate way.

Disadvantages :-

  1. My client side code is available to everyone. Its javascript.
  2. More prone to browser errors.
  3. Not robust.

Disadvantages after making it server-side:-

  1. Considering the traffic of my website, server load will increase as it will be engaged with a client for longer time.
  2. Fetching values from various websites can take as much as 10s(at max).Server engaged for that time. Consider the load if I have 500 visitors/min at peak time.

Advantages:-

  1. My codes safe and secure
  2. Processing at client side will be minimum. Will work even on mobiles and other devices easily.

I want to analyze about these issues before actually implementing them. Can anyone suggest me about what should I choose for my website ? Which approach will be better for me ?

Please comment if my question is ambiguous.


Solution

  • Well first of all thats a very nice question.

    it completely depends on the volume and transactions your site handles and if you really want your application to scale, i wish you do it right! and do it right from the beginning.

    Stop putting your business logic on the client side ** dont expect to eat end user network bandwidth when he makes a comparison call :) and dont expect he has the best bandwidth.

    Load balance your server farm make sure your server farm is properly load balanced and the comparison is done using multi threads instead in a single thread

    cache results ** if you are doing this on the server side, if user a and user b asks for the same comparison you can actually pull it from the cache for user b instead doing these requests again.

    Usability show the progress of comparison to user instead showing a loading spinning image :)

    hope it helps