ideas

Devnot workshop

I will be guest of Devnot next week on 10th of October and make a workshop about Elastic Beanstalk's auto scalability features. Here you can find the event's details and you can register from Eventbrite's page. Here is the detailed architecture for the workshop.

I will demonstrate scalability with respect to CPU utilization, memory usage and reuqest count.

Here is the plan. I am planning to consume Twitter Streaming API and store random tweets to MongoDB and use tweets for increasing memory usage of the application which is deployed with Elastic Beanstalk. And at the same time I want to add tweets to cache, so I need a Amazon ElastiCache instance. I will use 700 mb of memory for caching and I will demonstrate how easy to read/write to Memcached. I am planning to increase the CPU usage simply by successivly calculating π number. And I will write an easy application which makes API calls and I am planning to test scalability by number of requests. Sounds good!

adjusting cpu usage programmatically

CPU usage adjusting Here I wanna give information about tuning the CPU usage. Since you don't know how many CPU clock cycle your program consumes in a specific time, it's very hard to adjust the CPU usage like 60%. I don't find a good way to do this with using Java. A way to increase CPU usage is a while true loop but the only problem it increased the usage to 100% :) But luckily today's CPUs has more than one core and while true loop uses only one core, so with a four core CPU it's possible to adjust the usage at least to 25%, 50%, 75% and 100% with using threads.

simple test application

And what about application? I am planning to write a simple Spring MVC web application. I will put four buttons for increasing/decreasing CPU usage and memory usage.

  • Increase CPU usage button: Calculate Pi flag is set to true in the cache and in the MongoDB. App will check if Calculate Pi is true in every 10 seconds. When it is true, app will start to calculate Pi number till the desired CPU load is reached and system automatically adds an instance.
  • Decrease CPU usage button: Calculate Pi flag is set to false in the cache and in the MongoDB. When app realize Calculate Pi is no more true, app stops calculating Pi number and CPU usage of the instance will decrease and system removes an instance.
  • Increase memory usage button: Increase Memory Usage flag 's set to true in the cache and in the MongoDB. App will check this flag and when it's true app will start to fetch tweets from MongoDB and store in the app's memory. When it reaches max memory new instance will be added automatically and app will stop storing data.
  • Decrease memory usage button: Increase Memory Usage flag 's set to false in the cache and in the MongoDB. When it's false app will clear stored data and an instance will be removed automatically.

All these adjustments will be monitored by cloud watch and also scaling operations will be followed by AWS online console/

What about request count? It's easier, a simple app will make API calls and scaling operations will be monitored.

Here is the plan and I will push this demo code to github (Committed but sorry I'm too lazy to write read me! Feel free to ask about the details) next week and we will see if the plan is OK or not :) I will share another post after the workshop.

Developers! Developers! Developers!! Hell yeah! I still can't believe this guy has an NBA team! LA Clippers!


Soner ALTIN