On February 12-14, the well-known WSO2Con 2013 conference took place . And its leader was Eben Upton (Eben Upton) - the founder and trustee of the Raspberry Pi Foundation.
How it all started ...
The Raspberry Pi has been stirring the minds of geeks ever since it was first announced. We were excited to hear that Eben would represent the conference and were even more surprised when Sanjiva suggested that we place the backend of the official application WSO2Con on a cluster of Raspberry Pi. Suggested what? Yes, he is always full of crazy ideas. The first meeting was held on December 23, 2012, the day before the team leaves for the Christmas holidays. At the time, we weren't even sure if it was possible to run an enterprise middleware on Raspberry Pi at all. But exploring the unknown is commonplace for WSO2, and achieving the unattainable is what we do here on a regular basis. Thus, a group of brave geeks challenged the creation of such a system. The project officially moved from a dead point on January 2 of this year.
Run Java and WSO2 middleware on Pi ?? You are crazy!
One of the leading geeks of WSO2, Lakmal, managed to launch Java on the Raspberry Pi, he even managed to launch WSO2 AppServer. However, the main concern was that it took 6 minutes just to start the AppServer on Pi. This was unacceptable to us, and we concluded that it was necessary to optimize the software to run in environments with limited resources. The Raspberry Pi B model has only 512MB RAM and an ARM processor with a frequency of 700 MHz. Two geeks from the core development team Carbon, Sameera and Pradeep took on the challenge of optimizing the core for such limited resources and soon introduced the concept. They were able to reduce the launch time to about one minute.
An unpleasant surprise
One of the main surprises lurked in the memory configuration of the Raspberry Pi. And although we had a model B, which has 512MB RAM, the raspi-config utility displayed only 256MB! It seemed we ran into a wall with a run! In the end, we only had 3 weeks before the conference and in no way could we get another party so quickly. But you should never despair and the WSO2 team searched for information on the network, but found only false. Finally, we found that the full “apt-get update”, and after that - “apt-get upgrade” and the raspi-config update solves the problem. Now all 512MB were available. Using raspi-config memory sharing functionality, we allocated only 16MB to the graphics processor. 16MB is enough, because we didn’t plan much use of the GPU by our application. ')
There is a contact!
Another problem we encountered was the supply of energy to the cluster. The use of individual power supplies is an expensive and impractical idea. Because we decided to build our own power system. We designed USB boards that distribute power, which themselves were connected to adjustable blocks of 5V. Raspberry Pi model B is powered by a current of 700-1200mA and the voltage between the two control points on the board (TP1 and TP2) must be within 4.7-5.2V. Initially, we faced several voltage sags, it was much lower than the 4.7V threshold. When analyzing the circuit, it turned out that the connecting wires had a resistance of 1-2 ohms, which caused a noticeable voltage drop. We solved this problem using thicker wires and constructed the board so that the drop in power was less than 0.5V, which, by the way, is less than the drop on a normal diode. The genius of electronics Sumedha is currently engaged in the construction of a pair of adjustable power supply systems. Below are some photos of the board and power sources in action.
What a mess!
We planned to place 20+ Raspberry Pi in our cluster for launching several WSO2 products. Well, the allocation of space on the working area and the concern that the wires did not get tangled was another test. We wanted to make a stand, but Sumedha advised to make a prototype of the stand first and test several different configurations before approving its final look. Sumedh, who hails from the city of carpenters, Moratuwa, is also good at carpentry. So, over the weekend, he quickly assembled the rack. Below is a photo of a rack with two shelves, with 8 Raspberry Pi each and a switch. Now we have expanded it to three shelves. Video at the end of the post.
We want to build the final rack using clean plastic sheets.
Raspberry Pi is everywhere!
After placing all the Pi in places, watching them became a new test. Finding out the IP address for creating an ssh session, rebooting, and WSO2 software has become difficult to manage. Connecting the HDMI cable and keyboard to each Pi in the cluster was an even less practical solution. Then we got the idea to create a Raspberry Pi control center. We quickly created a simple web application and placed it on StratosLive . Cron jobs that call Perl and Bash scripts written by Lakmal and Deep and placed on the Raspberry Pi will periodically send information to the control center and also check if there are any commands from the center waiting to be executed on Pi. Here are some of these commands: blink LED, reboot, refresh IP, turn on / off cluster power. Now, with just two clicks in the center interface, we can control the entire cluster of Raspberry Pi. Placing Pi in the rack can be another challenge if you have a large enough cluster. We used the standard LED flashing script on python, using the GPIO library to send signals to the Raspberry Pi. Using this functionality, we were able to locate each Pi and label it using the rack number and Pi number. Now we are working on connecting the buttons to each Pi, so that when pressed, the number of this machine is displayed in the control center.
Download me baby!
As soon as the cluster was turned on and started, we launched a series of load tests JMeter. Preliminary testing was performed with the 8 Pi cluster. With 750 requests being sent simultaneously, the cluster maintained a bandwidth of 350 TPS, and the delay was on average 1 second.
Control Center in action
In this video, the team experiences a cluster management center. Chatter in the background - in Sinhala (Sri Lanka).
We will present a demo booth at WSO2Con in London and gifts to visitors will include the Raspberry Pi model B, the SD card with the Raspbian image and the case for the Raspberry Pi. Take a look at our demo booth and we will allow you to connect your Pi to the cluster and immediately see how it will start processing requests from the conference application. We will also hold a session on how we created this installation and application.
Note : in the original of the second part of the article there are diagrams and source codes of the application, as well as a detailed presentation of the process.Comments are welcome in PM.