High-Load Applications in the Cloud? No Problem!

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

Imagine you’ve created an awesome website. You’ve got it running smoothly, app servers and databases whirring along. Your application is quite popular and users from all over the world love it. Life is great! … BUT, then you hit a speed bump: as your traffic has been growing, so has the load on your application, and it’s causing it to run slower and slower and you start to see user attrition…

Or, you decided to add some features and updates to your application, but your system is unavailable during the upgrade. The result? You start losing users…

So, what’s the solution? How do you deal with large data caches and still have zero downtime?

Well, it’s super easy with Jelastic! With Memcached system in Jelastic you can kiss that problem goodbye. Thanks to our users, this feature became one of the leaders in our “Features competition” and voila! – now it is available in the Jelastic’s dashboard.

Let’s take a look at Memcached and see how to use it in Jelastic.

Memcached is a free and open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular programming languages. A few popular Memcached users are LiveJournal, Wikipedia, Flickr, Bebo, Twitter, Typepad, Yellowbot,
Youtube, Digg, WordPress.com, Craigslist and Mixi.

You can think of it as a short-term memory for your applications. Basically, Memcached allows you to make better use of your memory.

BTW you can find a pretty cool story of Caching by Brad Fitzpatrick here.

Note: this feature is available beginning from version 1.8.2.

Now let’s take a look at the more technical details and how it works.

Memcached’s APIs provide a giant hash table distributed across multiple machines. When the table is full, subsequent inserts cause older data to be purged in least recently used order. Applications using Memcached typically layer requests and additions into RAM before falling back on a slower backing store, such as a database. The more RAM you allocate, the more data you can store and therefore the more effective your cache is.

This system uses a client–server architecture. The servers maintain a key–value associative array and the clients populate this array and query it. Keys are up to 250 bytes long and values can be at most 1 megabyte in size.

The scheme below represents two deployment scenarios:

1. Without Memcached. In this case each node is completely independent.

2. With Memcached. In this case each node can make use of memory from other nodes.

The first scenario illustrates the classic deployment strategy, however you’ll find that it’s both wasteful in the sense that the total cache size is a fraction of the actual capacity of your web farm, but also in the amount of effort required to keep the cache consistent across all of those nodes.

With memcached, you can see that all of the servers are looking into the same virtual pool of memory. This means that a given item is always stored and always retrieved from the same location in your entire web cluster.

Memcached also allows you to make better use of your memory.

Also, as the demand for your application grows to the point where you need to have more servers, it generally also grows in terms of the data that must be regularly accessed. A deployment strategy where these two aspects of your system scale together just makes sense.

Getting Memcached up and running in your Jelastic environment is easy:

1. Go to jelastic.com and sign up if you haven’t done it yet or log in with your Jelastic credentials by clicking the Sign In link on the page.

2. Click Create environment to set up a new environment in Jelastic.

3. In the Environment Topology dialog, pick your application server (for example,Tomcat 6). Switch on Memcached. Specify the cloudlets limit. Then type your environment name, for example, memcached, and click Create.

That’s all you need to do! Now Memcached is available in your environment. Enjoy!

A quick reminder and thank you: this feature was implemented thanks to our users’ votes and feedback. Thank you to every that has voted and continues to do so!

Don’t hesitate to suggest new features for Jelastic and vote for others ideas here. The more votes a feature gets – the higher priority it gets in the roadmap, just like Memcached.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

One Comment

Leave a Reply

Subscribe to get the latest updates