Mobile apps & Server Apis, the weak link? par Emanuele Pecorari

2,287 views

Published on

Mobile apps & Server Apis, the weak link ? Open discussion on the mobile apps, and server apis/webservices based on video's return on experience after the recent relaunch of its mobile apps.
http://fr.viadeo.com/en/profile/emanuele.pecorari

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,287
On SlideShare
0
From Embeds
0
Number of Embeds
1,081
Actions
Shares
0
Downloads
15
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Mobile apps & Server Apis, the weak link? par Emanuele Pecorari

  1. 1. Mobile apps & ServerAPIs, the weak link?
  2. 2. Summary1. Why going for mobile?
  3. 3. Summary1. Why going for mobile?2. The Viadeo mobile app
  4. 4. Summary1. Why going for mobile?2. The Viadeo mobile app3. Are mobile applications only a client?
  5. 5. Summary1. Why going for mobile?2. The Viadeo mobile app3. Are mobile applications only a client?4. Our architecture
  6. 6. Summary1. Why going for mobile?2. The Viadeo mobile app3. Are mobile applications only a client?4. Our architecture5. Issues to face
  7. 7. Internet is changing From here … to there !
  8. 8. GLOBAL MOBILE TRAFFIC GROWING RAPIDLY TO REACH10% OF INTERNET TRAFFIC
  9. 9. SMARTPHONE USER ADOPTION HASHUGE UPSIDE POTENTIAL
  10. 10. GOOD NEWS:MONETIZATION ALSO GROWING RAPIDLY
  11. 11. MOBILE IN VIADEO Viadeo mobile Tianji mobile Improve user Improve user experience with mobile experience with mobile Mobile labs Launch new apps to boost traffic
  12. 12. NEW: VIADEO MOBILE BUSINESS UNIT→ Go Fast !→ Autonomous - not independant ;-)→ Lean Startup mode
  13. 13. THE VIADEO APPLICATION The video
  14. 14. THE USER WANTS…1. No crash!
  15. 15. THE USER WANTS…1. No crash!2. A fast application
  16. 16. THE USER WANTS…1. No crash!2. A fast application3. Small traffic and save battery life
  17. 17. THE USER WANTS…1. No crash!2. A fast application3. Small traffic and save battery life4. Security
  18. 18. USER WANTS A SUPER APP ONLY FOCUS ON CLIENT SIDE DEVELOPMENT?
  19. 19. FOCUS ON CLIENT SIDE1. Native vs HTML52. Design and ergonomy3. Responsive interface4. Follow guidelines
  20. 20. BUT…Limited capabilities of the devices
  21. 21. BUT…Limited capabilities of the devices GREAT
  22. 22. BUT…Limited capabilities of the devices BUT GREAT
  23. 23. BUT…Limited capabilities of the devices BUT GREAT NOT SO GREAT
  24. 24. FEATURE PHONES?
  25. 25. ARE THEY IMPORTANT?
  26. 26. BUT…Slow and unreliable network1. 4G
  27. 27. BUT…Slow and unreliable network1. 4G2. 3G
  28. 28. BUT…Slow and unreliable network1. 4G2. 3G3. EDGE
  29. 29. BUT…Slow and unreliable network1. 4G2. 3G3. EDGE4. GPRS
  30. 30. FOCUS ON THE SERVER SIDE A GREAT CLIENTAPPLICATION BEGINS ON SERVER SIDE
  31. 31. TO BE CONSIDERED1. API sends a lot of data (XML/JSON) -> my feed of news can be 60kb
  32. 32. TO BE CONSIDERED1. API sends a lot of data (XML/JSON) -> my feed of news can be 60kb2. Mobile applications need to reduce number of requests to get data
  33. 33. TO BE CONSIDERED1. API sends a lot of data (XML/JSON) -> my feed of news can be 60kb2. Mobile applications need to reduce number of requests to get data3. API needs to serve millions of mobile devices
  34. 34. WHAT CAN WE DO?1. Transform, filter and compress data
  35. 35. WHAT CAN WE DO?1. Transform, filter and compress data2. Aggregate calls on server side
  36. 36. WHAT CAN WE DO?1. Transform, filter and compress data2. Aggregate calls on server side3. Scalable architecture
  37. 37. VIADEO MOBILE ARCHITECTURE VIADEO API MEMCACHE, DATABASE, …
  38. 38. VIADEO MOBILE ARCHITECTURE MIDDLE END or VIADEO API MOBILE API MEMCACHE, (6 servers) (2 servers) DATABASE, …
  39. 39. NodeJS1. Small memory footprint
  40. 40. NodeJS1. Small memory footprint2. Event driven architecture (single event loop vs multiple blocking threads)
  41. 41. NodeJS
  42. 42. NodeJS1. Small memory footprint2. Event driven architecture (single event loop vs multiple blocking threads)3. Great to work with JSON
  43. 43. Middlend usage exampleSMARTNEWS
  44. 44. Middlend usage exampleSMARTNEWSNews proposed targeting yourareas of interest.More you use Viadeo, more thesmartnews will be accurate
  45. 45. Middlend usage exampleSMARTNEWSNews proposed targeting yourareas of interest.More you use Viadeo, more thesmartnews will be accurateThe JSON data in the next slide is whatthe API sends for a single news
  46. 46. Middlend usage example
  47. 47. Middlend usage example
  48. 48. EVERYTHING IS OK?DOWNLOAD OF THE CONTACTS LISTAfter the login, the application starts todownload the complete list of your Viadeocontacts
  49. 49. EVERYTHING IS OK?DOWNLOAD OF THE CONTACTS LISTAfter the login, the application starts todownload the complete list of your Viadeocontacts
  50. 50. EVERYTHING IS OK? DOWNLOAD OF THE CONTACTS LIST After the login, the application starts to download the complete list of your Viadeo contactsSome users have contacts list with thousands of contacts
  51. 51. ProblemMiddleend makes parallel calls to the APIto get the contacts list and send back tothe user: Parallel calls of 200 contactsUser with 5000 contacts = 25 calls x 200 contacts
  52. 52. TestTest of the preprod platformwith many parallel calls gives you good results
  53. 53. Problem Launch of new iPhone application
  54. 54. Problem Launch of new iPhone application Big traffic increase and many calls to download the contact list
  55. 55. Problem Launch of new iPhone application Big traffic increase and many calls to download the contact list Access time to memcache and database increases
  56. 56. Problem Avg. Response time (ms)160001400012000100008000600040002000 0 10:30 10:31 10:32 10:33 10:34 10:35 10:36 10:37 10:38 10:39 10:40 10:41 10:42 10:43 10:44
  57. 57. Problem RESULT: Access to memcache and database is very slow or impossible The application doesn’t work
  58. 58. What’s going on?• Put useful information about performances in your log• Use good realtime analysis tools • AppDynamics • Splunk• Use data mining tools • Datameer• Setup alert system to get warned about performance issues
  59. 59. Source of the problemsYour production environment is differentfrom the preprod environment:1. Not only mobile traffic on the API (widgets)2. Webapp access to the backend resource3. Presence of daemon and batches that access the memcache or the database
  60. 60. Solutions1. Optimize the way middleend downloads the contact list to decrease charge on API2. Reduce access to database and memcache (code improvements)3. Optimize calls to the API (reduce numbers of calls or data size)4. Reduce the impact of other systems especially in traffic peak time
  61. 61. Other thoughts around mobile app and API ERROR CODESOften API are designed to answer only withHTTP code to notify errorsEnhance your response with data in the JSONresponse to allow client to really recognize theerror and show an appropriate message to theuser. NOT ONLY 400 (BAD REQUEST)
  62. 62. Other thoughts around mobile app and API1. Additional error code in the Json response and recognize it on application side2. Add a specific message in the Json response that the application can show to the user (manage multiple languages)
  63. 63. Other thoughts around mobile app and API VERSIONING{"id": "jhAzouiEhDiDoaligeyAAslvAA","picture": "http://myphoto.com/images/photos/3749237498/"} WHAT IF I NEED TO CHANGE TO:{"id": "jhAzouiEhDiDoaligeyAAslvAA","picture_link": "http://myphoto.com/images/photos/3749237498/"}
  64. 64. Other thoughts around mobile app and API VERSIONING• Impossible to update all the mobile applications at the same time to support the new structure• Server must be able to respond both to old and new versions requests
  65. 65. Other thoughts around mobile app and API VERSIONING• Send both fields?{"id": "jhAzouiEhDiDoaligeyAAslvAA","picture":"http://myphoto.com/images/photos/3749237498/""picture_link":"http://myphoto.com/images/photos/3749237498/"}
  66. 66. Other thoughts around mobile app and API VERSIONING• Use the Http «Accept» header: server load the response model and serialize the response according to the version 1.0Accept: /myapplication1.0{"id": "jhAzouiEhDiDoaligeyAAslvAA","picture": "http://myphoto.com/images/photos/3749237498/"}Accept: /myapplication2.0{"id": "jhAzouiEhDiDoaligeyAAslvAA","picture_link": "http://myphoto.com/images/photos/3749237498/"}
  67. 67. Other thoughts around mobile app and API KEEP CLIENT AUTHENTICATED• First connection: authenticate your client accessing the Database• Store the information in session and sends back the session-id to the client• Mobile app sends the session-id in the next requests• Server can check the existence of a session without accessing the database
  68. 68. MOBILE TEAM IS HIRING PASSIONATE ABOUT MOBILE? SEND US YOUR CV: hrit@viadeo.com
  69. 69. Thanks a lot for your attention! Q&A Emanuele Pecorari Mobile Architect epecorari@viadeoteam.comhttp://fr.viadeo.com/en/profile/emanuele.pecorari © Viadeo 2010

×