Currently the mobile market is expanding rapidly and very important; so it’s strategic that we take mobile into account when planning a solution. There will be a significant number of people accessing apps using connected devices like Smartphones, Tablets, Slates, etc. Based on this we need to take into account one very important thing, connectivity, in this case, wireless. In order to better understand the amount of data we are talking about, AT&T stated that “We will deliver as much data over our network in the first 5 weeks of 2015 as we did all year in 2010”. That statement illustrates how much more we’re going to need to take these types of devices into account.
In this article we’ll be focusing on some of the Best Practices that, when used, will make our applications even better and easier to reach on Connected Devices.
When building these kinds of applications we have different kinds of data that can be accessed by the client from Databases, to Files; and these Files can be Static or Dynamic.
Best Practice: Get Out of the Way When You Can
If we talk about Static Content the best thing to do would be to send the client directly to Windows Azure Blob Storage, instead of placing some Hosted Service in the middle, since this way we can use the Auto-Scaling capabilities of Windows Azure Storage to manage the load of our Blob Data. This is very important for:
- Media – like images, videos,
- Binaries – like XAP, ZIP, MSI, DLLs,
- Data Files – like XML, CSV, XLSX,
Best Practice: Serve Public Blobs using Windows Azure CDN
Also very important when talking about Static Content is that it should be available as close as possible to the client to reduce latency and serve the client quicker. If we enable Windows Azure CDN, it will propagate the files into the 24 nodes that currently exist in the CDN allowing them to be automatically closer to the client. This will also allow us to deliver the content to more customers, simultaneously reducing the number of transactions and the latency on the central storage account.
Best Practice: Always Secure Your Content
When delivering content, we may have some static content which is public and some that isn’t. When sensitive files need to be shared, we should always use Windows Azure Shared Access Signatures to enable security since it provides direct access to the content in a controlled (ACLed) environment and access can be time-bound and revoked on demand. This way our private content will continue to stay private, while at the same time be accessible directly.
To use Shared Access Signatures we should place a Windows Azure Compute node that will be contacted whenever a Client needs to access specific private content. This Compute node will be responsible for generating the Shared Access Signature that should be used by the customer, and since it’s time-bound, the client device can store it and use it while it’s still active. By not allowing the Device to do the Shared Access Signature generation, we’ll be able to manage all access and prevent any unauthorized requests for content.
Best Practice: Partition your Data
When we talk about data it’s very important that it’s scalable and for that we need to partition our Data. The data can be partitioned Horizontally (aka Sharding), Vertically, or Hybrid. Normally we do Hybrid partitioning even if we don’t think of it, since we place all Relational Data inside a SQL Azure Database and all the Files inside Blob Storage, even if those files are related to the elements that exist inside the Relational Database.
If we need to partition the same type of data, we can partition it Horizontally (Sharding), which is basically done by splitting our data across several different nodes that have the same schema associated, like the example below.
Best Practice: Choose your Data Storage Strategy Correctly
Also important when talking about Data is the fact that we need to choose our storage location carefully as that will influence our partitioning and even the scalability or our application. We should choose the storage location based on the type of data as well as the way it’s consumed, so if we have data that is searched intensively and needs to be indexed we should choose SQL Azure, but if we don’t need that data to be highly indexed then Windows Azure Table Storage will be best suited for it.
Best Practice: Cache your Data
Another very important part of making your device solutions better is to cache your data, since we are never “always on”, and sometimes we can be “online” but we prefer not to be because of costs, for example when we need to use Roaming. Because of this we should always cache our data in order to keep from incurring costs, and also to avoid unnecessary stress onto the Compute or even Storage nodes.
We can also use In-Memory caching in the Compute node on Windows Azure; using this method we can use Windows Azure Caching to avoid stressing the Storage nodes too much.
Best Practice: Consume Services efficiently
When we’re consuming services on our mobile devices one very important piece of information to keep in mind is the size of the communication that is taking place, since this will affect our solution’s scalability, costs, and also usability. We should always take into account that receiving the results in JSON format is a lot smaller than receiving it in a XML format, but at the same time there may be significant differences in interoperability and security so you’ll need to keep these things in mind.
Best Practice: Always Enable Compression on Dynamic Content Types
Compression is very important because this way we can shrink the data transmitted through the wire, resulting in reduced costs for us and the customer.
These Best Practices are essential and, when used, will improve our solution. Getting acquainted with Best Practices will make working with Windows Azure even easier and more efficient.
In this article we haven’t taken any particular focus on architecting or the Backend costs of the mobile solution, since that would need to be addressed in a different article.