{"id":191,"date":"2011-04-19T15:24:17","date_gmt":"2011-04-19T15:24:17","guid":{"rendered":"http:\/\/mikekuphal.azurewebsites.net\/?p=191"},"modified":"2011-04-19T15:24:17","modified_gmt":"2011-04-19T15:24:17","slug":"my-notes-from-the-architecting-backend-systems-for-mobile-session","status":"publish","type":"post","link":"https:\/\/mikekuphal.com\/?p=191","title":{"rendered":"My notes from the Architecting Backend Systems for Mobile session"},"content":{"rendered":"<p>Speakers: <a href=\"http:\/\/twitter.com\/#!\/burcaw\" target=\"_blank\" rel=\"noopener\">Dan Burcaw<\/a>\u00a0<span>\u00a0<\/span>&amp; <a href=\"https:\/\/twitter.com\/#!\/ejoep\" target=\"_blank\" rel=\"noopener\">Joe Pezzillo<\/a><span>\u00a0 <\/span>(<a href=\"http:\/\/twitter.com\/#!\/PushIO\" target=\"_blank\" rel=\"noopener\">Push IO<\/a>) &#8211; former Apple employees<\/p>\n<p>Their current application infrastructure supports iOS, Android, Windows Phone 7 (and some other that they can\u2019t discuss)<\/p>\n<p>Admitted Real time data\u2026 is their focus.<span>\u00a0 <\/span>Might\u00a0bias their info.<\/p>\n<p>SOAP is out!\u00a0 Payload is just way to bloated.<\/p>\n<p>REST is in (with JSON)<span>\u00a0 <\/span>-lightweight<\/p>\n<p>Parser Speed Iphone 3Gs: Built in iOS xml parser takes 2 seconds! Even best is just under a second.. That\u2019s a long time on a mobile device.<\/p>\n<p>Many of the fastest engines also have feature tradeoffs\u2026 just don\u2019t have a ton of great options when looking at a XML parser from a performance perspective.<\/p>\n<p>JSON performance is way faster: A few tested: Touch JSON,<span>\u00a0 <\/span>JSON Framework, YAJL, ApplJSON \u2026<span>\u00a0 <\/span>Worse case of writing &lt; 0.5 second.. Reading &lt;0.1 sec<\/p>\n<p>JSONKit is blazing fast.<span>\u00a0 <\/span>This is a new one to look at.<\/p>\n<p>JSON benefits:<\/p>\n<ul>\n<li>Compact data format (even more compact if whitespace is stripped)<\/li>\n<li>Very fast read\/write speeds compared to XML<\/li>\n<li>JSON Libraries make it easy to convert from dict key\/values into native objects<\/li>\n<li>JSON is well-supported on the server-side<\/li>\n<\/ul>\n<p>TIP: Use <a href=\"http:\/\/www.jsonlint.com\" target=\"_blank\" rel=\"noopener\">JSONLint.com<\/a> to view and ensure JSON is formated correctly.<\/p>\n<p>Backend scalability\/performance:<\/p>\n<p>Data requests: Mobile is much more async.<span>\u00a0 <\/span>A different kind of load that can bring down server from traditional web based traffic.<span>\u00a0 <\/span>To coordinate the data your WebService is providing,\u00a0You likely need to use one or more databases.<span>\u00a0 <\/span><\/p>\n<p>Might be best to make a ton of smaller calls, instead of \u2018a large data set\u2019 all at once.<span>\u00a0 <\/span>Don\u2019t frontload the data load as that doesn\u2019t scale well.<\/p>\n<p>Probably best to increase the number of calls your app makes, by making lots of calls for small amounts of data, only\u00a0data that you need at that point.<span>\u00a0 <\/span><\/p>\n<p>Databases: Consider using in-memory databases such as Redis or Memcached to eliminate request\/response bottlenecks.<span>\u00a0 <\/span>Traditional disk-based dbs don\u2019t scale well when serving medium to large scale mobile apps do to the volume of async requests.<\/p>\n<p>Tip:\u00a0Use in memory databases on the front end, then write to disk db periodically.<span>\u00a0 <\/span>They use a <a href=\"http:\/\/fedoraunity.org\/solved\/server-solutions\/lamp-stack\" target=\"_blank\" rel=\"noopener\">\u2018LAMP stack\u2019<\/a> (these are called noSQL db\u2019s)<\/p>\n<p>Couch DB, mongoDB, Redis or Memcached are most popular NoSQL db\u2019s now.<\/p>\n<p>TIP: Web server settings: be sure to turn on GZIP compression.<span>\u00a0 <\/span>This HTTP Header setting will reduce the size of the data payload sent across the wire.<span>\u00a0 <\/span><\/p>\n<p>Mobile data files: not all data needed by mobile apps need a full fledged SOAP\/REST WS:<\/p>\n<p>Consider publishing static (vs dynamic) JSON files to a CDN, which avoids taxing your servers with dynamic requests.<\/p>\n<p>This is really saying.. Determine data that is static.. and make that something different to call\u2026 instead of dynamic seek on all<span>\u00a0 <\/span>data requests.<\/p>\n<p>CDN pricing is \u2018very cheap\u2019 if you aren\u2019t dealing with Video.<span>\u00a0 ( <\/span>&lt; fewer than $50 over a number of months)<\/p>\n<p>TIP: When working with CDN\u2019s, set your time to live very low.<span>\u00a0 <\/span><\/p>\n<p>Static file could be written out every second (more like 30 seconds).<span>\u00a0 <\/span>That\u2019s static in the mobile world (expand your mind here)\u2026 could certainly do this thing on a min by min basis.<span>\u00a0 <\/span>This really offloads traffic to the CDN instead of the Caching benefits of a CDN.<\/p>\n<p>Server virtualization has some limits: Performance in particular.<span>\u00a0 <\/span>MySQL performance suffers on a virtualized server.<span>\u00a0 <\/span>Switched to \u2018Bare Metal\u2019 MySQL.<span>\u00a0 <\/span>Even that wasn\u2019t performing as well\u2026<span>\u00a0 <\/span>this is why they went to the in memory (noSQL) DB\u2019s.\u00a0 This is a probably when you exceed a \u2018reasonable number of users\u2019<span>\u00a0 <\/span>think 10,000 users type thing.<\/p>\n<p>Mobile apps\u2026 people don\u2019t linger like on the web\u2026 lots of requests instead of just one on mobile.<span>\u00a0 <\/span>(check it, check it, check it\u2026 lots of little data requests)<\/p>\n<p>Registration\/personalization doesn\u2019t map well to the Mobile data files technique.<span>\u00a0 (Writes of data need to be handled differently than the consuming of data on the handheld.)<\/span><\/p>\n<p>Realtime tips:<\/p>\n<ul>\n<li>REST-full WebServices with JSON Responses<\/li>\n<li>Gzip compression<\/li>\n<li>Mobile data files via CDN (low cache control policies)<\/li>\n<li>In-memory databases<\/li>\n<li>Load balancers and multiple worker nodes.<\/li>\n<\/ul>\n<p>Theme =\u00a0\u201dDo as little as possible in realtime\u201d for highly scalable solutions.<\/p>\n<p>Overall, I received many tips to consider.\u00a0 Opened up my mind to many new possibilities to consider for\u00a0the systems I currently work with and felt I gained a large amount of background info to consider as we grow our user base.\u00a0\u00a0I am most interested in seeing what we might be able to do with a NoSQL\u00a0DB.\u00a0 This may be a great first step for us.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Speakers: Dan Burcaw\u00a0\u00a0&amp; Joe Pezzillo\u00a0 (Push IO) &#8211; former Apple employees Their current application infrastructure supports iOS, Android, Windows Phone 7 (and some other that they can\u2019t discuss) Admitted Real time data\u2026 is their focus.\u00a0 Might\u00a0bias their info. SOAP is out!\u00a0 Payload is just way to bloated. REST is in (with JSON)\u00a0 -lightweight Parser Speed &hellip; <a href=\"https:\/\/mikekuphal.com\/?p=191\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;My notes from the Architecting Backend Systems for Mobile session&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-191","post","type-post","status-publish","format-standard","hentry","category-mobileconnections"],"_links":{"self":[{"href":"https:\/\/mikekuphal.com\/index.php?rest_route=\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mikekuphal.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mikekuphal.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mikekuphal.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mikekuphal.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=191"}],"version-history":[{"count":0,"href":"https:\/\/mikekuphal.com\/index.php?rest_route=\/wp\/v2\/posts\/191\/revisions"}],"wp:attachment":[{"href":"https:\/\/mikekuphal.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mikekuphal.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mikekuphal.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}