title: Where to run complex algorithms? Server side or Client side?
body: <p>I am trying to develop an social networking android application which contains huge database of users. I am very new to Android App development and trying to understand the concepts behind the app development. 
  I am using following technology :</p>
  
  <p>1) MYSQL + PHP (RESTful Web Services)
  2) Android Studio (Java)</p>
  
  <p>In the application, I have to run some complex algorithms for ranking users collecting data from different tables from database stored in cloud server.</p>
  
  <p>My question is "where to run this algorithms?". 
  Should I write code in PHP to make the algorithms run in server side and then send this data to client 
  (or)
   Should I write the code in JAVA (Android Studio) using data collected from server.</p>
  
  <p>How will the performance of my app differs in both cases?</p>
  
  <p>Edit : Thanks for all your responses. </p>
  
  <p>I have idea on Async Tasks and Multi Threading. </p>
  
  <p>This doubt came to me as ranking is common for all my users, there is a difference. If I put raking algorithm in server side, even though the results are same for all users, the same algorithm has to run for several times (say if there are 10000 users, the same algorithm runs for 10000 times on server side). But if I do put in client side, I may over come this. But need expert solution on this.</p>