Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Deel III: Paradigma’s Software Ontwikkeling 4. Ontwerp van Telecom Services Prof.Dr.Ir. Filip De Turck Vakgroep Informatietechnologie Domotica Telecom Services Vakgroep Informatietechnologie Home Use case RFID reader Television Service Gateway Siemens Pylix / Porta Television 1 RFID reader Software Ontwikkeling I User with tag and PDA Multimedia Content Provider Home Use Case (with user priorities) : Need for User Priorities RFID reader Television 1 User with tag and PDA 2 Multimedia Content Provider Service Gateway Siemens Pylix / Porta User Priority 1 3 2 5 Television 2 RFID reader Software Ontwikkeling I User with tag and PDA User Policies are not supported in OSGi -> research topic Home Use Case (with user priorities) : Need for Service Priorities End user Service Priority Video on demand 1 Surveillance 9 RFID reader Home Surveillance Service Television Service Gateway User without valid RFiD tag Television 1 User with PDA RFID reader Software Ontwikkeling I Multimedia Content Provider Home Use Case (with service priorities) : End user Service Priority Video on demand 1 Surveillance 9 RFID reader Home Surveillance Service Television Multimedia Content Provider Service Gateway Television User without valid RFiD tag 1 User with PDA RFID reader Software Ontwikkeling I Technical realization of user and service policy enforcement UPnP Media OSGi Service Gateway Home Surveillance Service End user RenderPriority Service Video on demand 1 Surveillance 9 Service Gateway Television UPnP Media Streamer Software Ontwikkeling I Multimedia Content Provider Home networks Intelligente Gateway tot het home netwerk Besturing security systeem USB Complete afscherming gebruiker (black box) netwerk Apparaten Protocollen Vermelde Software Software + framework Home Router X10 technologieën X10 OSGi Software Ontwikkeling I Elektriciteitsnet X10 Intelligente router Apparaat X10 Controller X10 Module opdracht adres commando Voor mij? Lichtnet Software Ontwikkeling I Cross compiling Makefile CC=/usr/crossdev/mips/bin/mips-linux-gcc LD=/usr/crossdev/mips/bin/mips-linux-ld all: test test: test.c $(CC) -g -c test.c $(LD) -o test test.o –lc –lx10 # $(CC) -static -o test test.c libx10.a clean: rm -f test *.o Software Ontwikkeling I Example Code #include <stdio.h> #include "x10_api.h" void new_error_handler(int code, char *arg, struct x10_status_t *status); void function_hook(unsigned char house, int unit, int function, int dim_level, struct x10_status_t *status); int main(int argc,char **argv) { struct x10_status_t *status; int return_code; /* We open the API */ if(!(status=x10_open("/dev/ttyS0", new_error_handler, function_hook, 10000000))) { fprintf(stderr,"Could not open the serial port %s !\n",argv[1]); exit(1); } printf("\n\nNow turning ON the A5 module ...\n"); return_code = x10_send_cmd('A', 5, X10_CMD_ON, 0, status); printf("x10_send_cmd return code = %d\n",return_code); x10_close(status); Software Ontwikkeling I } Enabling Java-based VoIP backend platforms through JVM performance tuning Vakgroep Informatietechnologie Outline Introduction Java 4 Telecom Evaluation Setup Java Virtual Machine Default behavior Possible Optimizations Optimized Behavior Results Conclusions Software Ontwikkeling I Introduction Software backend platforms are increasingly popular in VoIP offerings. Java is currently one of the most popular programming languages for implementing business logic. Is Java suitable for implementing VoIP and telecom related applications? Java Application Servers for Telecom related applications are emerging: SIP Servlet JAIN SLEE Software Ontwikkeling I Telecom Applications: VoIP Telecom related applications have very specific requirements Example: Softswitch Low Latency High Throughput How fast can it set up a call? How many calls can in set up per second? Java 4 Telecom? Software Ontwikkeling I Java Virtual Machine: Features Java Byte Code is executed by a virtual Machine This makes it platform independent Java features automatic Memory Management and a Garbage Collector This simplifies the task of the developer Software Ontwikkeling I Java Virtual Machine: Problems Java Byte Code is executed by a virtual Machine This can be a performance penalty Java features automatic Memory Management and a Garbage Collector This can cause a performance penalty due to unpredictable behavior of the system. Software Ontwikkeling I Evaluation: Proxy 200 benchmark Alice Proxy Bob Invite Invite Trying [100] Ringing [180] Ringing [180] OK [200] No OK [200] ACK Measured Time Interval Media transfer BYE OK [200] Software Ontwikkeling I ACK Media Session started when benchmarking BYE OK [200] Evaluation Setup: Hardware Perform routing Internet Alice Proxy Bob Software Ontwikkeling I Dual Opteron 1.6Ghz 2GB RAM Linux kernel 2.6 Evaluation Setup: Software SIP Servlet JAIN SLEE BEA Weblogic SIP Server Open Cloud Rhino Benchmark software SIPp (test tool / traffic generator for the SIP protocol) Software Ontwikkeling I SIP Servlet: Architecture cycle management Manage network listen points similar to HTTPServlet SIP Protocol Specific Request Response Model … Servlet Life Servlet based Servlet Container … Very Application JAIN SIP Servlet API SIP Stack Container SIP Servlet Server Application client Software Ontwikkeling I Life based SBB Container cycle management Protocol Agnostic Resource Adaptors allow protocols to be “plugged in” Manage Activity ctx JAIN SLEE: Architecture … … Application Proxy JAIN SLEE SBB API network Listen Points Event driven and asynchronous JAIN SIP JAIN JCC SIP RA JCC RA JAIN SLEE Container JAIN SLEE Server Application client Software Ontwikkeling I Results: SIP Servlet (default) Response time as a function of call rate and system load 200 100 Response time (ms) 160 50 ms 25 ms System load 90 80 140 70 120 60 100 50 80 40 60 30 40 20 20 10 0 0 Software Ontwikkeling I 50 100 150 Call Rate (caps) 200 0 250 System Load (%) Average response time 50th percentile 95th percentile 180 Cause of the problems? Memory Management and Garbage Collector Legend Heap Usage GC-Time GC-occurrence Tenured Gen. Young Gen. Image created with gcviewer (http://www.tagtraum.com/gcviewer.html) Software Ontwikkeling I Solution: Virtual Machine Tuning Memory Organization Garbage Collection Software Ontwikkeling I Memory Tuning Fixed Young Generation Size Software Ontwikkeling I Virtual Perm Perm Virtual Tenured generation Virtual Size large enough TenuredVirtual Total Heap Perm generation Tenured Eden Virtual Survivor Survivor Eden Tiny Survivor Young generation Spaces Other Generation Sizes NOT Fixed Garbage Collector Tuning Parallel & Concurrent Concurrent Parallel Default Multi- GC partially GCparallel with Longthreaded GC Application pauses Execution Performance implications: More resources are spent on Garbage Collection Only for tenured young All generations generation Software Ontwikkeling I Tuning Options -Xmx512m -XX:MaxNewSize=32m -XX:NewSize=32m -XX:+UseParNewGC Selection of the -XX:+UseConcMarkSweepGC Garbage Collector -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing Allow multi-XX:CMSIncrementalDutyCycleMin=0 -XX:CMSIncrementalDutyCycle=10 threaded memory -XX:+UseTLAB -XX:MaxTenuringThreshold=0 -XX:SurvivorRatio=128 Sizing of the memory generations Software Ontwikkeling I allocation Move long living objects to Tenured Generation Problems solved? Legend Heap Usage GC-Time GC-occurrence Tenured Gen. Young Gen. Image created with gcviewer (http://www.tagtraum.com/gcviewer.html) Software Ontwikkeling I Results: SIP Servlet Response time as a function of call rate and system load 200 100 Response time (ms) 140 80 70 120 60 100 50 80 40 Improved Latencies 60 25 ms 90 Higher CPU load 160 50 ms System load 40 30 20 20 0 10 0 Software Ontwikkeling I 50 100 150 Call Rate (caps) 200 0 250 System Load (%) Average response time 50th percentile 95th percentile 180 Results: JAIN SLEE (untuned) Response time as a function of call rate and system load 200 100 Response time (ms) 160 50 ms 25 ms System load 90 80 140 70 120 60 100 50 80 40 60 30 40 20 20 10 0 0 Software Ontwikkeling I 50 100 150 Call Rate (caps) 200 0 250 System Load (%) Average response time 50th percentile 95th percentile 180 Results: JAIN SLEE Response time as a function of call rate and system load 200 100 Response time (ms) 160 50 ms 25 ms System load 90 80 140 70 120 60 100 50 80 40 60 30 40 20 20 10 0 0 Software Ontwikkeling I 50 100 150 Call Rate (caps) 200 0 250 System Load (%) Average response time 50th percentile 95th percentile 180 Conclusions Java Technologies can simplify the Design and Management of Telecom and VoIP related applications Java Virtual Machine Tuning can improve the Java Garbage Collection significantly Java Application Servers combined with appropriate tuning can meet strict Low Latency Requirements Software Ontwikkeling I Telecom Services on handheld devices Vakgroep Informatietechnologie Handheld devices – different OS In-house / specific Windows Mobile Symbian OS Embedded Linux Palm OS BlackBerry Software Ontwikkeling I Handheld devices – J2ME • modular and scalable architecture • Configuration: CLDC / CDC Applications • Profiles: MIDP / FP / P (basis) P • Mobile phones: MIDP 2.0 Profile Optional Packages CLDC 1.1 “MIDlet (suite)” • WMA, MMAPI, Bluetooth APIs • Nokia UI Software Ontwikkeling I Vendorspecific classes Configuration Native Operating System Device / Hardware Handheld devices – J2ME Development steps for a MIDP application 1. Compilation using an ordinary Java compiler 2. Conversion of the classes to CLDC format (preverification) 3. Creation of the manifest file 4. Packaging into a JAR-file (+ creation of the JAD-file) SUN’s WTK IDE Netbeans Mobility Pack 5. Installation onto the target device - through WAP - through PC-connection (e.g. Nokia’s PC Suite) Software Ontwikkeling I Handheld devices – J2ME Code Examples • Webaccess - through HttpConnection String getViaHttpConnection(String url) throws IOException { HttpConnection c = null; InputStream is = null; StringBuffer str = new StringBuffer(); try { c = (HttpConnection)Connector.open(url); // Getting the InputStream will open the connection and read the HTTP headers. // They are stored until requested. is = c.openInputStream(); // Get the length and process the data int len = (int)c.getLength(); int ch; while ((ch = is.read()) != -1) { str.append((char)ch); } } finally { if (is != null) is.close(); if (c != null) c.close(); } Software Ontwikkeling I Handheld devices – J2ME Code Examples • SIP - JSR 180 “SIP API for J2ME” - defined as Optional Package - minimum requirements: CLDC 1.0 public void sendTextMessage(String msg) { SipClientConnection sc = null; try { // open SIP connection sc = (SipClientConnection) Connector.open("sip:[email protected]:5060"); // initialize SIP request MESSAGE sc.initRequest("MESSAGE", null); // set some headers sc.setHeader("From", "sip:[email protected]"); sc.setHeader("Subject", "testing..."); ... Software Ontwikkeling I Handheld devices – J2ME Code Examples ... // write message body sc.setHeader("Content-Type", "text/plain"); sc.setHeader("Content-Length", Integer.toString(msg.length())); OutputStream os = sc.openContentOutputStream(); os.write(msg.getBytes()); os.close(); // close stream and send the message to the network // wait max 15 seconds for response sc.receive(15000); // response received if(sc.getStatusCode() == 200) { // handle 200 OK response } else { // handle other responses } sc.close(); } catch(Exception ex){ // handle Exceptions } } Software Ontwikkeling I Handheld devices – J2ME Code Examples Video Service - JSR 135 MMAPI (Mobile Media API) - provides a framework for playing media content - designed to run with any protocol and format The method below plays a video file the on mobile device: ... Player p; VideoControl vc; try { p = Manager.createPlayer(“rtsp://server/somemovie.mpg"); p.realize(); // get video control vc = (VideoControl) p.getControl("VideoControl"); .... p.start(); } catch(IOException ioe) { } catch(MediaException me) { } ... Note: This will only work on devices which support real time input streams! Software Ontwikkeling I Handheld devices -Windows CE The Operating System Windows CE = a modular OS that serves as the foundation of several classes of devices Windows Mobile = a subset of platforms based on Windows CE - high market share in the PDA market (~50%) - 2003 - Pocket PC - Smartphone - Pocket PC Phone Edition - 5.0 - Pocket PC - Smartphone - Portable Media Center Software Ontwikkeling I Handheld devices - Windows CE Software development • native code - Visual C++ - high performance - direct hardware access - smallest footprint • managed code through the .NET CF - Visual Basic and Visual C# - Rapid Application Development - No bad pointers or memory leaks Software Ontwikkeling I Handheld devices - Windows CE .NET Compact Framework - subset of the .NET framework - base class libraries + few additional libraries - 2 versions : 1.0 (2003 / 2003 SE) & 2.0 (5.0) Visual C# code Compiler Common Language Infrastructure Common Intermediate Language Visual Basic code Compiler Software Ontwikkeling I Common Intermediate Runtime 0111 0100 1010 1101 0101 Handheld devices - Windows CE Code Examples • Webaccess - through System.Net.WebClient The following example takes the URI of a resource, retrieves it, and displays the response. … if (args == null || args.Length == 0) { throw new ApplicationException ("Specify the URI of the resource to retrieve."); } WebClient client = new WebClient (); // Add a user agent header in case the requested URI contains a query. client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); Stream data = client.OpenRead (args[0]); StreamReader reader = new StreamReader (data); string s = reader.ReadToEnd (); Console.WriteLine (s); data.Close (); reader.Close (); } … Software Ontwikkeling I Handheld devices - Windows CE Code Examples • SIP Windows CE .NET User Application Windows CE .NET VoIP UI 3rd Party User Applications Windows CE .NET VoIP Middleware (incl. VoIPMgr) RTC API Core SIP Media Manager Provisioners Databases MS RTP Transmission Control Protocol/Internet Protocol (TCP/ IP) Point-To-Point Protocol (PPP) Network Driver Interface Specification (NDIS) Serial Drivers Hardware • Since Windows CE 4.2 : VoIP TUI is a fully functional, customizable, and extensible suite of common telephony features for users. • Third party SIP API : http://www.independentsoft.com/ Software Ontwikkeling I Handheld devices - Windows CE Code Examples using Independentsoft.Sip; using Independentsoft.Sip.Sdp; … client = new SipClient("sipdomain.com","Bob","password"); client.ReceiveRequest += new ReceiveRequestEventHandler(OnReceiveRequest); client.ReceiveResponse += new ReceiveResponseEventHandler(OnReceiveResponse); client.Connect(); client.Register("sip:test.com", "sip:[email protected]", "sip:[email protected]"); Console.WriteLine("Send message to Alice or press \"q\" to exit."); string message = ""; while(message != "q"){ Console.Write("Bob:"); message = Console.ReadLine(); client.SendMessage("sip:[email protected]","sip:[email protected]",message);} client.Disconnect();} private static void OnReceiveRequest(object sender, RequestEventArgs e) { client.AcceptRequest(e.Request); if(e.Request.Method == SipMethod.Message){ Console.WriteLine("Alice:"+e.Request.Body);} … Software Ontwikkeling I Handheld devices - Windows CE Code Examples • Video service - through e.g. DirectX 9.0 SDK using Microsoft.DirectX.AudioVideoPlayback; public class MyVideoPlayer : System.Windows.Forms.Form { ... private void OpenFile() { try { Video ourVideo = new Video("C:\\Example.avi"); ... } } ... } Software Ontwikkeling I Handheld devices – Symbian OS The Operating System • multitasking OS designed for 2.5G and 3G mobile phones • very high market share in the smartphone market (~70%) • the successor of the Epoc OS • started as version 6.0 and currently into version 9.2 • advanced, open standard OS to its licensees • (Sony) Ericsson, Nokia, Panasonic, Samsung and Siemens • software development: J2ME and Symbian C++ Software Ontwikkeling I Handheld devices – Symbian OS Symbian C++ • ≠ standard C++ • offers highest performance and functionality on Symbian OS • 4 standardized software frameworks Resolution (pixels) User Interaction 208-240 x 320 pen-based (+ small keyboard) Series 60 176 x 208 central navigation key Series 80 / 9200 Series 640 x 200 full keyboard Series 90 640 x 320 pen-based UIQ • code not complete portable between the different frameworks ( ~ 80 %) Software Ontwikkeling I Handheld devices – Symbian OS Code Examples • Webaccess - opening a session class CHttpClient : public CBase, ... {... private: RHTTPSession iSession; ... }; CHttpClient::CHttpClient() {... iSession.OpenL(); ...} - creating a transaction void CHttpClient::InvokeHttpMethodL(const TDesC8& aUri, RStringF aMethod) { ... TUriParser8 uri; uri.Parse(aUri); RHTTPTransaction trans = iSession.OpenTransactionL(uri, *iTransObs, aMethod); ... }; Software Ontwikkeling I Handheld devices – Symbian OS Code Examples • SIP - Nokia plugin for Series 60, 2nd Edition - integrated in Series 60 Platform, 3rd Edition (v9.1) - initiation of the SIP client API iSIP = CSIP::NewL(KAppUid, *iMySIPObserver); iConnection = CSIPConnection::NewL(*iSIP, KIapIdentifier, *iMyConnectionObserver); - registration of a SIP user CleanupStack::PushL(aor); CSIPAddress* addr = CSIPAddress::DecodeL(_L8("sip:[email protected]")); CleanupStack::PushL(addr); CSIPContactHeader* contact = CSIPContactHeader::NewL(addr); CleanupStack::Pop(addr); CleanupStack::PushL(contact); CSIPRefresh* refresh = CSIPRefresh::NewLC(); iRegistration = CSIPRegistrationBinding::NewL(*iConnection, aor, contact, refresh); CleanupStack::Pop(3); Software Ontwikkeling I Handheld devices – Symbian OS • Video service Code Examples - CVideoPlayerUtility provides a simple interface to open, play and obtain information from sampled video data. The video data can be supplied either in a file, a descriptor or a URL - streaming supported ( MVideoLoadingObserver) class CRMMVideoRenderer : public CBase, public MVideoPlayerUtilityObserver, public MVideoLoadingObserver { private: CVideoPlayerUtility* iVideoPlayerUtility; …} … iVideoPlayerUtility = CVideoPlayerUtility::NewL( *this, iPriority, iPref, iWindowSession, *iScreenDevice, iDisplayWindowhandle, iDisplayWindowRect, iClipWindowRect ) … // turn on the status reporting for connecting, buffering, and re-buffering iVideoPlayerUtility->RegisterForVideoLoadingNotification(*this); … // load a videostream TRAPD( err, iVideoPlayerUtility->OpenUrlL( iUrl, iIapId, iMimeType, iControllerUid ) ); if ( err != KErrNone ) { iObserver->ErrorMsg(err); } Software Ontwikkeling I