Successfully reported this slideshow.

Final report.doc.doc


Published on

  • Be the first to comment

  • Be the first to like this

Final report.doc.doc

  1. 1. Android – An Open Handset Alliance Project Glenn M. Bernstein Peter Lonjers Computer Science & Engineering Computer Science & Engineering Department Department University of California University of California Riverside, CA. 92521 Riverside, CA. 92521 (951) 892-8682 ABSTRACT XML is remote procedure calling using HTTP as the This paper describes a UDP and XML-RMC communication transport and XML as the encoding. XML-RPC is designed to mechanism executed on the first complete, open and free mobile be as simple as possible while allowing complex data structures platform[1]. We believe XML-RPC will be increasingly to be transmitted, processed and returned.[2] An XML message important in the future because it is a spec and a set of is an HTTP-POST request. The body of the request is in XML. implementations that allow software running on disparate A procedure executes on the server and the value it returns is operating systems, running in different environments to make also formatted in XML. Procedure parameters can be scalars, procedure calls over the internet[2]. We implemented a numbers, strings, dates, etc.; and can also be complex record connectionless connection or UDP connection and a XML and list structures. connection using a high level object oriented language called Here’s an example of an XML-RPC requrest. Java and compared the performance of two remote procedure calls. POST /RPC2 HTTP/1.0 User-Agent: Fronteir/5.1.2 (WIN NT) Categories and Subject Descriptors Host: D.4.8 [Operating Systems]: Performance – measurements. Content-Type: text/xml General Terms Content-length: 181 Measurement, Performance, and Reliability. <?xml version=”1.0”?> Keywords <method Call> Connection performance. <methodName>examples.getStateName</methodName> 1.INTRODUCTION <params> Android allows you to access core mobile device <param> functionality. Android combines information from the web with data on the phone – such as contacts or geographic location – to <value><i4>41</i4></value> create new user experiences. Android does not differentiate </param> between the phone’s basic and third-party applications – even the dialer or home screen can be replaced. The SDK contains </params> what you need to build and run Android applications, including <methodCall> a true device emulator and advanced debugging tools[1]. Header Requirements The format of the URI in the first line of the header is not specified. However, if the server is handling a mix of incoming HTTP requests, we allow the URI to help route the request to the code that handles XML-RPC requests. (In the example, the URI is /RPC2, telling the server to route the request to the “RPC2” responder). A User-Agent and Host must be specified. Permission to make digital or hard copies of all or part of this work for The Context-Type is text/xml. personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that The Content-Length must be specified and must be correct. copies bear this notice and the full citation on the first page. To copy otherwise, or republish, to post on servers or to redistribute to lists, Payload Format requires prior specific permission and/or a fee. Conference’xx Month xx–xx, 20xx, City, State, Country. The payload is in XML, a single <methodCall> structure. The Copyright 20xx ACM 1-58113-000-0/00/0004…$5.00. <methodCall> must contain a <methodName> sub-item, a
  2. 2. string, containing the name of the method to be called. Its entirely up to the server to decide how to interpret the characters in a methodName. If the procedure call has parameters, the <methodCall> must contain a <params> sub-item. The <params> sub-item can contain any number of <param>s, each of which has a value. Scalar <value>s <values>s can be scalars, type is indicated by nesting the value inside one of the tags such as: Tag Type Example <i4> or <int> four-byte signed integer -12 Here’s an example of a response to an XML request This paper focuses on the UDP and XML_RPC communication mechanism, and compares how XML-RPC runs HTTP/1.1 200 OK from an Android Client to a Server versus UDP that runs Connection: Close entirely within Android. Section 2 discusses the issues that arise in the design of an Android program and the experimental Content-Length: 158 methodology. Section 3 presents the implementation and summarizes performance measurements of an XML-RPC run on Content-Type: text/xml windows XP and Ubuntu Linux operating systems. Also, this Date: Sat, 22 Mar 2008 16:03:xx GMT section presents the implementation and summarizes performance measurements of a UDP connection within the Server: Ucr Orpheus/xx.x-Centos Android platform. Section 4 concludes. <?xml version=”1.0”?> <methodResponse> 2.XML-RPC and UDP Design The challenge was to develop a lightweight web service <fault> communication. The KML-RPC is a lightweight implementation (goes light on the resources) of the XML-RPC <value> protocol. This library works with the J2ME SDK so it requires <struct> modification to work with the Android SDK. In addition, one method of a class in a package threw an exception upon the <member> return of a value, or when the parser receives an XML with no <name>faultCode></name> actual data and the modification is to modify the server so that is sends default empty values or change the client parser to <value><int>4</int></value> consider this case. Future work can develop an Android XML- RPC server that will cooperate with the XML-RPC client we </member> wrote. The remote procedures are implemented with the use of </struct> a server scripting language. </value> The UDP is a straightforward User Datagram Protocol implemented entirely within the Android platform. The </fault> protocol avoids the overhead of checking whether every packet <methodResponse> arrived and makes UDP faster and more efficient than the XML- RPC protocol as shown in Section 3 [4]. A goal of this protocol is to lay a compatible foundation across different environments. Firewall software can watch for POSTs whose Content-Type is text/xml[3]. In contrast, UDP are commonly implemented in network applications such as the Domain Name Service (DNS), streaming media applications such as IPTV, Voice over IP (VoIP), and Trivial File Transfer Protocol (TFTP)[4].
  3. 3. client for display and the measurement of execution time. The running time of 20! was 0.419 seconds and was the result of running the XML-RPC application on a ubuntu 7.10 operating 3.IMPLEMENTATION system with 1 Gigabit of RAM and a 1.7 GHz processor speed. This section describes our implementation. First we discuss the UDP package. Then we discuss the XML-RPC package. A run of this application with the Windows XP professional operating system with 512 MB of RAM and a 801 MHz Intel 3.1UDP Pentium III processor averages 2.18 seconds for the 5! iterative A subactivity starts two threads a server thread that waits for a and 7.69 seconds for the 10! Iterative including the outliers. The packet and that the client sends 500ms later. On the server side server uses Python as a scripting language. Figure 3 is below. two remote functions are implemented or the iterative and recursive version of the calculation of factorial. To test the Iterative XML_RPC effect of data type on the calculation, a test suit uses the int data 60000000000 type(5!) and a test suit that uses the long data type follows(20!). To test the effect of input size on the execution time, the input 50000000000 size initially is 5! And 20! follows. Figures 1 and 2 are below. UDP Chart 40000000000 1000000000 nanoseconds 5! Iterative 900000000 30000000000 10! Iterative 800000000 20000000000 700000000 600000000 nanoseconds 10000000000 Iter 5! int 500000000 Recursive 400000000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 yi 300000000 200000000 100000000 4.Conclusion 0 UDP (User Datagram Protocol) is a communications protocol y12 y19 y1 y2 y3 y5 y6 y7 y8 y9 y10 y11 y13 y14 y15 y16 y17 y18 y20 y21 y22 y23 y24 y25 y26 y27 y28 y29 y30 y4 yi that offers a limited amount of service when messages are exchanged between computers in a network that uses internet UDP 20! protocol (IP). UDP is an alternative to the transmission control protocol (TCP) and, together with IP is sometimes referred to as UDP/IP. The application program that uses UDP must be able 900000000 800000000 to make sure that the entire message has arrived and is in the 700000000 right order. UDP provides two services not provided by the IP layer. It provides port numbers to help distinguish different user 600000000 requests and, optionally, a checksum capability to verify that the data arrived intact[5]. nanoseconds 500000000 Iterative 400000000 Recursive XML-RPC is a simple protocol, defining a handful of data 300000000 types and commands which is a start contrast to most RPC systems, where the standards documents often run into the 200000000 hundreds of pages and require considerable software support to 100000000 be used. As new functionality was introduced , the standard evolved into what is now SOAP[6]. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 yi This paper concludes that a UDP remote procedure call requires about 0.3-0.4 seconds to execute. In addition, the use The average execution time for the iterative version of 5! was of the long data type may reduce the execution time as the 20! 0.3496 seconds and the recursive version was 0.3839 seconds. Long data type iterative version executes in less time that the 5! Similarly, the average iterative execution time for 20! was int data type call. The XML-RPC requires longer execution 0.3412 seconds and the recursive version was 0.4334 seconds. . time. On the Ubuntu operating system the execution time is the This application was run on a Windows XP professional same order of magnitude as the UDP mechanism. On the operating system with service pack 2 installed, and run by an Windows XP operating system, the execution time is an order of 801MHz Intel Pentium III processor. The laptop consists of 512 magnitude slower than the UDP mechanism. MB of RAM memory. 5.ACKNOWLEDGMENTS 3.2XML-RPC Our thanks to goes to Professor Brett Fleish for his guidance, The XML-RPC client sends parameters over an http post to the and the development site. server which executes a remote procedure call. The remote procedure call then returns the result through XML-RPC to the
  4. 4. 6.REFERENCES [5]WWW=,,si [1] WWW= d26_gci214157,00.html [2] WWW= [6]WWW= [3] WWW= [7] Birrell, Andrew D., Nelson, Bruce Jay., 1984. Implementing Remote Procedure Calls. In Proceedings [4]WWW=http://www.en.wikipedia/Wiki/User_Datagram_ of the xxth Annual ACM Symposium on…(State, Protocol Country, February xx - xx, 1985).. ACM Press, New York, NY, 39-59.