Smart Computing Review, vol. 2, no. 2, October 2012 339 Smart Computing Review A Load Balancing Protocol for IP Based Pervasive Networks Ali Ziya Alkar 1 and John Şefik Roach 2 1 Electrical and Electronics Engineering Dept. Hacettepe University/ Beytepe, Ankara, Turkey / alkar@hacettepe.edu.tr 2 Research and Development Department, Renko LTD. / Gölbaşı, Ankara, Turkey / johnroach1985@gmail.com * Corresponding Author: Ali Ziya Alkar Received July 9, 2012; Revised September 26, 2012; Accepted October 1, 2012; Published October 31, 2012 Abstract: IP based solutions without network routers are becoming popular as the need to lower complexity and maintenance cost emerges. The systems without a central server are relatively inexpensive and easier to configure per each system environment. The only necessity is to be at close proximity to a direct internet connection. In this way the home/industrial automation systems could be accessed and controlled through a direct internet connection directly even in dynamic IP configurations. In addition there are advances where the communication between devices is made possible. Communication between IP based pervasive devices may load the server used while relaying the data from one device to another. This study looks at load-balancing issues of the IP based pervasive devices among intercommunicating units. The suggested methodology has been tested on an IP based pervasive system. Keywords: IP, network, automation, pervasive, load balancing Introduction I P Based solutions especially in the world of automation have become popular as interconnected devices have exponentially increased through the years. The network solutions with a central server are not easy to maintain and configure [1]. Therefore systems with direct ability to connect and interact autonomously are expected to dominate the market in the near future. One of the typical scenarios in the internet based automation systems is a refrigerator being connected through the internet to look up its food contents, as well as the expiration date of the items, and the like which can be made possible via an RF ID marking system. In this way, it is possible to keep track of what to buy thus unnecessary purchases can be DOI: 10.6029/smartcr.2012.05.008
340 Alkar et al.: A Load Balancing Protocol for IP Based Pervasive Networks avoided. At home, one will be able to designate the hours during which children may watch TV even while not physically present by remotely arranging the settings accordingly. Television may be turned on via the internet and channels can be blocked [2][3]. Heaters or airconditioner units may be turned on prior to arriving home. Settings of the refrigerator may be changed while on vacation to conserve power. The applications are not only limited to home [4][5][6]. Drug inventories may be tracked in pharmaceutical warehouses for better service. Humidity levels around farm fields may be followed up remotely, via sensors for proper irrigation [7] There are internet based automation examples [8] that have been implemented without using a router where the system is based on a special dedicated network which is not a generic solution. Another proposed approach [9] is the research which is only based on a model and without any hardware implementations. The study in [7] is a solution for home automation systems that provides means to access a server without the necessity of a router. These kinds of systems are likely to increase in the future as there are no set up requirements and enable communication in an efficient way. However as in this system and all systems that depend on a remote server, data transfer load will increase upon the said server when user interaction and appliances increase. In this paper, we present a load balancing protocol that will allow home automation appliances and sensors to communicate with each other. This new load balancing protocol will allow a better service performance to the masses that use automation in their daily lives and disburden the load of the manufacturers or the server providers. The proposed system has been tested on the framework in [7]. Some of the other benefits of this new protocol are to be manufacturer independent and its added security functions which is becoming an important concern in pervasive systems. The next section will briefly explain the units in the basis of the framework mentioned in the reference design in [7] for the sake of completeness. Section 3 discusses the load balancing protocol suggested with a sample run. Section 4 is the conclusions. IP BASED HOME AUTOMATION FRAMEWORK Before we detail the load balancing solution to the systems that use a central server we would like to describe the base system that is our point of concern. The base system is outlined in Figure.1 as described in [7] with our extensions to the framework. Internet Application Server User IPAcBox Enabled Hardware Figure 1. General Overview of the system with added protocols The user connects to a predetermined configured application server, which is located anywhere in the world through the internet by either a mobile phone or a laptop/desktop computer. The IP enabled home network devices or appliances are connected to the same application server, and stay connected as long as they are not disconnected. The dashed lines in the Figure.1, between the IP enabled hardware are implemented as a part of our work in this study. The IPAcBox system described is formed of hardware and software components as outlined below. More details can be obtained from [7]. The hardware technology is implemented on a microcontroller based interfacing circuitry that communicates with the appliance and the software server [9][10][11]. This hardware unit with a microcontroller, special interfacing circuitries and network connection is named as the IP Access Box (IPAcBox). The data packets sent from the appliance are processed and sent to the network via the IPAcBox. Software modules required by the software server are the
Smart Computing Review, vol. 2, no. 5, October 2012 341 PHP 1 server, an object oriented open source programming language, SSH 2, SQL 3 database and an open port for the chat software server to communicate with the IPAcBox. IPAcBox connects to a designated server. In the server, a database to compare and analyze the information sent via the IPAcBox is available, along with PHP and an object oriented open source programming language software to provide a user interface to process the incoming data. In terms of operation, the system needs no further configuration on the user side. This is a very important feature provided by the unique connection scheme as described in [7]. After the physical connection of the hardware to the appliance through the USB interface, the user connects to the homepage of the software server. The user creates a profile in the first run of the program. Then the user accesses the designated home page by entering the username and password. The name, unique serial number for the item, and the passwords of the products can be added. Figure 2. Device management The devices such as a fridge as seen in this example, can be added to the main screen after the user logs in as shown in In Figure.2. It can be seen that the device is turned on and the user can select the appliance to visualize further about the appliance. LOAD BALANCING PROTOCOL The problem with the current system, and all pervasive systems that need to intercommunicate with each other is that all data needed to be sent through the application server which could overload the application server in situations where there are too many IP enabled items connected. The limit of the items connected is about 100 for a server with 2 GB memory. While designing the load balancing protocol, the security of information and fast data transmission were kept in mind. To this extent, we have used a native SSH (Secure Shell) protocol and a communication protocol that has been suggested in this paper. During this research there were two things that was essential to our study: The first was that the items must not exchange data without the user s consent and the second was that the user should not have to know the extensive knowledge of the 1 PHP is a general-purpose server-side scripting language originally designed for Web development to produce dynamic Web pages. 2 Secure Shell (SSH) is a network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel over an insecure network: a server and a client (running SSH server and SSH client programs, respectively). 3 SQL (Structured Query Language) is a programming language designed for managing data in relational database management systems (RDBMS).
342 Alkar et al.: A Load Balancing Protocol for IP Based Pervasive Networks software that is running in the background [12][13][14]. Thus, we have proposed the following communication protocol and divided this section into three parts; these are the network creation, server-ipacbox and the inter IPAcBox protocols. Network Creation After adding an appliance, the user is diverted to a new page requesting a new network to be created as shown in Figure.3. Figure 3. User network creation notices The user will still be able to use the items in the list however; the items will not be able to interact with each other without adding a network. In Figure.3, we can see that the user has two items that might interact with each other namely, the camera and the TV. When the add a new network link is accessed the user is directed to a simple form where a network name can be entered. After the network is created, the server appoints a unique name by simply adding a UNIX timestamp and the user s md5 4 coded username at the end of the user given name for added security. An example will be: Mynetwork.fce5b6340a460aa23d2acf6c8817b430.1296567643 where Mynetwork is the user given name of the network while the rest is generated by the server. Once the network has been created, the user will be redirected back to the item catalogue as can be seen in Figure.4. Figure 4. Item notices for the selected network 4 The MD5 Message-Digest Algorithm is a widely used cryptographic hash function that produces a 128-bit (16-byte) hash value. MD5 has been employed in security applications, and is also commonly used to check data integrity. MD5 was designed by Ron Rivest. An MD5 hash is typically expressed as a 32-digit hexadecimal number.
Smart Computing Review, vol. 2, no. 5, October 2012 343 As it can be seen here, each network will be represented as in the form of a green box. In each network box, information about the network is clearly displayed. In Figure.4, one can see that the network is offline since there are no items added. To add an item the user simply needs to drag the items icon on the green network box, when that is done, the user will have the following screenshot as seen in Figure.5. Figure 5. Added item to network screenshot Now the user can see that the network is online and with a TV in the network. What if the user wants to simply get the camera data and give the output to the TV? In order to do that the user must simply drag the camera to the network box and simply click and drag the camera s blue box on to the TV s blue box. In the end, the screen shot will look like as in Figure. 6. Figure 6. CAM and TV working together As one can see, the CAM item is sending Video output to the TV. If the TV item was dragged over the CAM, an error would have been shown to inform the user that the TV has no data to share with the CAM. In the following section the background processes will be detailed. Server IPAcBox protocol
344 Alkar et al.: A Load Balancing Protocol for IP Based Pervasive Networks The authentication protocol of IPAcBox is detailed in [7]. If the IPAcBox firmware and server lists are up to date, then a special communication channel in the server has been established, which will be used only for unsecured transactions where the transfer speed is more important than safe transactions. The communication channel mentioned above could be thought as a chat room where only authenticated appliances are allowed. To this extent, an asynchronous multi-threaded script has been written. The following steps will be described by using the chart shown in Figure.7. Create Network For IPAcBox Application Server User Created Network ID P1 IPAcBox Python Layer P2 S1 Figure 7. Network Creation Process P1: Once the communication channel has been added, the IPAcBox will ask for its network name. If no network has been defined for the item, the server will send the following message; MAC@<IPBOX.IP>:def_network_please server@<server.ip>:@<mac>#no_network_def MAC@<IPBOX.IP>:got_message_no_network_def to indicate that no network has been defined. As one can see from the above the data transmission is quite simple. The value <server.ip> is actually the servers IP and the <MAC> is the unique MAC address for the item. If a network is later on defined by the user, the IPAcBox will receive the following message: server@<server.ip>:@<mac>#network_def#<unique_nam> MAC@<IPBOX.IP>:I_m_part_of_network Now the IPAcBox knows it belongs to a network which is named by the variable <unique_nam>. P2: Once the IPAcBox establishes that it is in a network and may be connected to other devices, it simply starts up a mini server. Although limited, this server will allow the IPAcBox to read any data streams sent to it by other IPAcBox enabled systems. S1: The network information related to the network such as its unique name is stored within a CSV file within the IPAcBox. The network is now established and a mini server has started in the IPAcBox. Inter IPAcBox protocol The chart in Figure.8 and its proceeding information will explain how inter item communication will be possible. The following steps detail this intercommunication.
Smart Computing Review, vol. 2, no. 5, October 2012 345 Inter Item Communications Init phase Application Server Layer P2 P5 IPAcBox 1 (TV) P1 P3 IPAcBox 2 (CAM) P1 P4 P6 Figure 8. Intercommunications of multiple items P1: Once the IPAcBox establishes that it is in a network it starts up a mini server. This mini server can be thought as an asynchronous multi-threaded chat server. P2: Server receives the word that the user wants to connect the CAM to the TV. Looking at which item is dragged on which item, the server assumes that the CAM will be feeding the TV with data rather than the other way around. Hence, it sends the MAC address of the CAM to the TV. P3/P4: Once the TV is informed about the MAC address of the destination, a connection will be established using the basic principles of the TCP/IP protocol. The IPAcBox of the TV scans for the IP that is used by that MAC address specified by the server. Once this IP (which is a local IP) is found the script sends the destination IPAcBox the simple command MAC1@<IPBOX1.IP1>:want_to_connect MAC2@<IPBOX2.IP2>:got_to_check_with_the_appserver In the above example the MAC1 named item (the TV) wishes to connect with MAC2 named item (the CAM) where MAC1 and MAC2 are their relevant unique MAC addresses. Due to security reasons, MAC2 must check with the application server whether the connection can be allowed. This is an added security feature of this protocol and implemented in P5. P5: The IPAcBox2 (the CAM) connects to the server using SSH. A small script on the server gets and checks the connected appliance s MAC, IP address and its encryption key. The encryption key (for the CAM) and the MAC2 address are unique and embedded within the IPAcBox2 (the CAM 2). If the encryption key and MAC address are correctly defined, the script accepts the second argument (using SSH) which is the TV s MAC. The server side script will this time check if IPAcBox1 (the TV) is really attached to the same network and if a valid output can be sent from the CAM to the TV. If all these are checked, the script will send via SSH, a file including an encryption key and a valid port, which will be used for the real time picture transmission. Once the file is sent, the server will inform IPAcBox2 by sending the following message: (not through SSH) server@<server.ip>:@<mac2>#go_out#<encrypted_file> to acknowledge the communication request of IPAcBox. P6:Once encrypted file has been received by the CAM and an acknowledgement has been sent back to the server the CAM will then check the file for consistency and will open said port. Once the port is opened and data is ready to be streamed, it will send the following message to the TV
346 Alkar et al.: A Load Balancing Protocol for IP Based Pervasive Networks MAC2@<IPBOX2.IP2>: appserver_said_ok After this, the data from the CAM will go directly to the TV using the internal IP s, IP1 and IP2 rather than going through the server within the internet. Load balancing Effects on the Server In order to demonstrate the need to set up a protocol to balance the load on the server and set up a secure protocol to divert the traffic to directly communicate the devices with each other some simulations have been performed. A simulation scenario of the new protocol clearly illustrates the effect of hierarchical data processing with no balancing. In Figure.9, the graph shows the access time for up to 1000 users with increasing number of appliances per user. Each appliance directly interacts with the server when users ask for information. Here we are assuming the user is seeking information from all appliances at once. Figure 9. The response time in No Load Balancing As we can see in the graph in Figure.9, as the number of appliances increases so does the time that it takes to evaluate and display the data to the user. In the next simulation, the load balancing algorithms and methodology utilized described in this paper is run. We observe that even though the number of appliances increases the delay time between responses on the server, it will not change as drastically as in the no load balancing case. In this test run we have again set the number of users as 1000. The graph for this test run is in Figure.10. Figure 10. The response time in with Load Balancing
Smart Computing Review, vol. 2, no. 5, October 2012 347 CONCLUSIONS In this paper, we introduced an elegant and unique procedure to balance the load in strongly connected pervasive devices which becomes a greater concern as the units communicate with each other. The directed traffic in this solution will allow more data to be sent between items without increasing the load on the server or on the out bounding bandwidth upon the user s network. This newly introduced load balancing feature offers novel benefits to IP automation designs. While in this paper we have only given an example on a TV connecting to a web CAM, the examples can be numerous where interconnecting items could form a dynamic hierarchy, ever changing, according to the users needs. By applying this framework, interconnecting items will have faster response time compared to a hierarchical access through the application server thus enabling users to connect and control various appliances without putting great loads on to the server and the internet connection bandwidth belonging to the user. References [1] A. R. Al-Ali, M. AL-Rousan, Java-Based Home Automation System, IEEE Transactions on Consumer Electronics, vol. 50, no. 2, May 2004. Article (CrossRef Link) [2] R. J. C. Nunes, A Web-Based Approach to the Specification and Programming of Home Automation Systems, in Proc. of IEEE MELECON 2004, pp.693, May 12-15, 2004. Article (CrossRef Link) [3] G. Song, Z. Wei, W. Zhang, A. Song, Design of a Networked Monitoring System for Home Automation, IEEE Transactions on Consumer Electronics, vol. 53, no. 3, Aug 2007. Article (CrossRef Link) [4] K. Tan, T. Lee, C. Yee Soh, Internet-Based Monitoring of Distributed Control Systems-An Undergraduate Experiment, IEEE Transactions on Education, vol. 45, no. 2, May 2002. Article (CrossRef Link) [5] C. C. Ko, B. M. Chen, S. Hu, V. Ramakrishnan, C. D. Cheng, Y. Zhuang, J. Chen, A Web-Based Virtual Laboratory on a Frequency Modulation Experiment, IEEE Transactions on Systems, Man, and Cybernetics-Part C: Application and Reviews, vol. 31, no. 3, pp. 295-303, Aug. 2001. Article (CrossRef Link) [6] P. Lin, H. Broberg, Internet Based Monitoring and Control for HVAC Applications, IEEE Industry Applications Magazine, pp. 49-54, Jan. 2002. Article (CrossRef Link) [7] A. Z. Alkar, J. Roach, D. Baysal, IP Based Home Automation System, IEEE Transactions on Consumer Electronics, vol. 56, no. 4, pp. 2201-2207, Nov. 2010. Article (CrossRef Link) [8] N.-S. Liang, L.-C. Fu, C.-L. Wu, An Integrated, Flexible, And Internet-Based Control Architecture For Home Automation System In The Internet Era, in Proc. of IEEE International Conference on Robotics and Automation, vol. 2, pp. 1101-1106, 2002. Article (CrossRef Link) [9] J. C. Nunes, J. C. M. Delgado, An Internet application for home automation, in Proc. of 10th Mediterranean Electrotechnical Conference, pp. 298-301, 2000. Article (CrossRef Link) [10] J. L. Ryan, Home Automation, Electronics and Communication Engineering Journal, pp.185, Jul./Aug. 1989. Article (CrossRef Link) [11] G. Song, Y. Zhou, W. Zhang, A. Song, A Multi-interface Gateway Architecture for Home Automation Networks, IEEE Transactions on Consumer Electronics, vol. 54, no. 3, pp.1110, Aug. 2008. Article (CrossRef Link) [12] H. S. Kim, J.-H. Song, S. Lee, Energy-Efficient Traffic Scheduling in IEEE 802.15.4 for Home Automation Networks, IEEE Transactions on Consumer Electronics, vol. 53, no. 2, pp.369, May 2007. Article (CrossRef Link) [13] P. Bergstrom, K. Driscoll, J. Kimball, Making Home Automation Communications Secure, IEEE Computer, pp.50, Oct. 2001. Article (CrossRef Link) [14] I. Han, H.-S. Park, Y.-K. Jeong, K.-R. Park, An Integrated Home Server for Communication, Broadcast Reception, and Home Automation, IEEE Transactions on Consumer Electronics, vol. 52, no. 1, pp.104, Feb. 2006. Article (CrossRef Link)
348 Alkar et al.: A Load Balancing Protocol for IP Based Pervasive Networks John Şefik Roach is currently working for Renko Ltd. in Ankara, Turkey. John is a Certified Application Developer (APTECH), Certified Information Systems Manager (APTECH), Open Software Developer. His specialties are but not limited to Java, Python, C#, C, JSP, ASP.Net, PHP, HTML/CSS/JavaScript, XML, Assembly, SQL, Microsoft SQL Server, Network Systems, RHL, Debian, UNIX, and Windows. Reliability tests for hardware and basic circuit design. His main interests are embedded software designs and computer networks. He is a member of the IEEE. Ali Ziya Alkar received his B.S. degree in 1988 at Electrical & Electronics Engineering Department, Hacettepe University, Ankara, Turkey. He completed his M.S. study in 1991 at the Electrical & Computer Engineering Department of the University of Colorado at Boulder, Colorado, U.S.A. In 1995 he received his Ph.D. from the same university. His main interests are computer architecture and design, and application of security algorithms to VLSI and embedded systems. Supervised and completed several government funded research projects. He is an Associate Professor at the Dept. of Electrical and Electronics Engineering, Hacettepe University. He is a member of the IEEE and advisor officer for IEEE at Hacettepe University. Copyrights 2012 KAIS