We have had the opportunity to work on an number of social/mobile oriented applications that require large-scale scalability to support millions of social interactions. Traditionally we have attacked this problem by using, in most cases, mysql with a heavy dose of big hardware and readonly replication to scale out reads as much as possible, for example. Not too many good options for scaling out writes although and writes are even more of a problem with relational databases if you can even afford the options.
With many social applications the bottleneck tends to be the database and storage tier since you typically have many many users trying to access social information and perform interactions with each other within the social network. Typically the app server tier is pretty easy to scale if your apps are stateless. It gets a bit more complicated if you need to handle real-time chat session for example. But for the typical social mobile application functions, you need massive horizontal read scalability. Trying to achieve this with traditional relational technology is a challenge and there are physical limits that are hard to break without spending big money on expensive database technology. You can keep getting bigger boxes and try to leverage readonly replication, for example, but that has its limits and the costs can become high, along with having single points of failure.
As noted, scaling out the reads is a bit easier by leveraging readonly replication but writes are harder since multi-master clusters can be expensive and hard to manage. The bottom line is that relational technology was never designed for this kind of scalability. Enter NoSQL and in particular MongoDB. We have been very excited and pleased so far with our experiences with MongoDB and NoSQL in general. It does take a little getting used to from modeling and programming perspective and the technology is still evolving but the potential is there to do what we can't do today with relational databases.
On some of our projects we have worked on we have gone with a pure MongoDB configuration and for other more challenging social/mobile apps we have used a more hybrid architecture that leverages both mysql and mongodb. We would like to eventually to reduce the dependency on mysql for such projects but msyql/relational are still better at some thing than MongoDB (we will delve into this in later blog post). And MongoDB is still evolving as we speak. But don't fear using a hybrid solution. On one project for example, we left most of the complex relationships in mysql and put only the high load read queries and high volume/velocity data in mongodb (although plan to port more over to mongodb in the coming months). Also MongoDB is much better at geo-locatoin based searches along with full text searching than what you can do with mysql.
Sharding is one of nice features with MongoDB that helps solve the problem of scaling out writes. The technology is still evolving and getting better but has way to go. Administration is a challenge and does have a learning curve but like most technology it can be mastered. Some reporting functions and transaction/locking features are still better and more efficient to do on mysql, but mongodob is closing the gap quickly with the releases planned for this year - keep an eye out for the new aggregation framework on MongoDB and the new Collections based locking.
So, for all those folks looking to build a highly scalable social/mobile app (I am sure everyone has a killer social app in mind :) give NoSQL and MongoDB a close look. Do not fear the new, the advantages far out weigh the learning curve for both programmers and administrators.
Wednesday, January 25, 2012
Saturday, November 20, 2010
Mobile Apps: Native vs Web
Many developers run into this debate when building mobile apps for iOS and Android. Modern smartphone OSes and browsers are now quite powerful and can run fully featured HTML5 web applications. So, why not build your apps in HTML5 (there are a few open source frameworks that can help as well) and just forget all the trouble of getting app store approvals and dealing with upgrade issues of installed native applications? Didn't we just leave fat clients and desktop apps in the dust in the 90s for all the great benefits of on-demand web applications (nothing to download or install...etc)?
The choice may not be so straight forward. Let us compare the the options for using web apps:
Pros:
Cons:
While web apps have some clear advantages, in the end, native apps just deliver a better experience to end users from both a user interface and marketing perspective. This may change in the future as HTML5 gets more powerful and there are better cross browser frameworks, web based store fronts, and rating systems for web apps. For now, going native represents the best overall option, but we are sure the debate will continue on.
The choice may not be so straight forward. Let us compare the the options for using web apps:
Pros:
- With web apps there is no store approval process needed
- Upgrade the app at your own leisure
- Build it once for Android and iPhone - many web frameworks let you build web apps that will run on Safari or Chrome
- Lots of developers familiar with javascript/html
- HTML5 gives you access to many low-level OS features (geo-location, local storage...etc)
- You are not alone. Big players like Google have gone the web app route for GVoice and GMail, to name a few examples
- Avoid revenue sharing with app stores
Cons:
- Your app is not easy to find - app stores make apps easier to find and rate
- Native apps have access to low level hardware/APIs like OpenGL and full access to the OS (more or less)
- Native apps generally can be made to look much better and perform faster
- Installing a native app is a much more seamless experience
- Can't use convenient revenue collection/sharing mechanisms available for paid apps and for in-app advertising and up selling features found in native APIs
- You can typically trust native apps not to do something sinister since they have been reviewed and approved by a higher authority
- Native apps have better debuggers and emulators
While web apps have some clear advantages, in the end, native apps just deliver a better experience to end users from both a user interface and marketing perspective. This may change in the future as HTML5 gets more powerful and there are better cross browser frameworks, web based store fronts, and rating systems for web apps. For now, going native represents the best overall option, but we are sure the debate will continue on.
About Exalt
Exalt is a proven technology innovator taking business mobile through the application of cutting edge mobile technology and superior UI design. Exalt specializes in web and mobile solutions leveraging a highly skilled team of Software Engineers, Information Architects and UI Designers.
Subscribe to:
Posts (Atom)