Presentation is loading. Please wait.

Presentation is loading. Please wait.

CHEN Ge CSIS, HKU March 9, 2000. Jigsaw W3C’s Java Web Server.

Similar presentations


Presentation on theme: "CHEN Ge CSIS, HKU March 9, 2000. Jigsaw W3C’s Java Web Server."— Presentation transcript:

1 CHEN Ge CSIS, HKU March 9, 2000. Jigsaw W3C’s Java Web Server

2 What is Jigsaw? Jigsaw is a Web Server developed by W3C. The source code is of version 2.0.4.Jigsaw is a Web Server developed by W3C. The source code is of version 2.0.4. Jigsaw is written in pure Java, and the document of Jigsaw claims “Jigsaw will run on any platform that supports Java, with no changes”Jigsaw is written in pure Java, and the document of Jigsaw claims “Jigsaw will run on any platform that supports Java, with no changes”

3 Jigsaw’s Internal Design Basic Concepts in JigsawBasic Concepts in Jigsaw –Resource –Frame –Filter –Indexer

4 Jigsaw’s Internal Design –A Resource is a full Java object, containing only information that the raw Resource (a file, a directory...) can provide (e.g., for a file, the size, last modification date...)

5 Jigsaw’s Internal Design –A Frame is a full Java Object, containing all the information needed to serve this Resource using a specific Protocol (e.g., HTTPFrame for HTTP). Jigsaw attaches Frames to Resources to handle protocol related activities.

6 Jigsaw’s Internal Design –A Filter is a full Java Object, associated to a Frame, that can modify the Request and/or the Reply. For example the Authentication is handled by a special filter.

7 Jigsaw’s Internal Design –A Indexer is also a full Java Object, which tries to create and setup some resource automatically. The resources can be created depending on their name or their extension. Once the resource has been created, the Indexer is also in charge of attaching the right frames to this resource, like the HTTP frame, the filters and so on.

8 Jigsaw’s Internal Design A sample FileResource:A sample FileResource:

9 Jigsaw’s Internal Design The inheritance tree of Jigsaw:The inheritance tree of Jigsaw:

10 Jigsaw’s Internal Design The ResourceStoreManageThe ResourceStoreManage –Jigsaw use a ResourceStoreManage to manage all the resource used in the runtime of the server. –The ResourceStoreManage’s implementation use some simple cache policy to make the resource reference more efficient.

11 Jigsaw’s Internal Design The ResourceStoreManageThe ResourceStoreManage –It seems that, if we start multiple Jigsaws on a machine, all the servers will share the same ResourceStoreManage.

12 How Jigsaw Works? Jigsaw utilize Java’s thread extensively. All the major classes of Jigsaw are running as Java Threads.Jigsaw utilize Java’s thread extensively. All the major classes of Jigsaw are running as Java Threads. Jigsaw separates serving document into two different processing stagesJigsaw separates serving document into two different processing stages –Indexing Stage –Serving Stage

13 How Jigsaw Works? Separate serving document into two stages make the resource lookup and resource sharing more efficent.Separate serving document into two stages make the resource lookup and resource sharing more efficent.

14 How Jigsaw Works? Using an sample http request handling process in Jigsaw to explain how Jigsaw works, and view some important classes in Jigsaw.Using an sample http request handling process in Jigsaw to explain how Jigsaw works, and view some important classes in Jigsaw.

15 How Jigsaw Works? When Jigsaw starts upWhen Jigsaw starts up –An instance of the class httpd created. httpd

16 How Jigsaw Works? httpd Initialize() httpd Indexer root manager

17 How Jigsaw Works? httpd Indexer root manager initializeServerSocket() After initialization, the httpd call the initializeServerSocket() to create the server socket and the ClientSocketFacotry which is a pool of SocketClient.After initialization, the httpd call the initializeServerSocket() to create the server socket and the ClientSocketFacotry which is a pool of SocketClient. httpd Indexer root manager Server port factory

18 How Jigsaw Works? After create the server socket successfully, httpd creates a thread, assigns itself to the thread, and runs as a thread.After create the server socket successfully, httpd creates a thread, assigns itself to the thread, and runs as a thread. httpd factory Indexer root manager this.thread = new Thread (this); ;…;this.thread.run(); httpd factory Indexer root manager

19 How Jigsaw Works? public void run () { … while ( ( ! finishing) && ( socket != null ) ) { Socket ns = null ; try { ns = socket.accept() ; ns.setTcpNoDelay(true); } catch (IOException e) { … } if ( (socket != null) && (ns != null) && (factory != null) ) factory.handleConnection (ns) ; } // Our socket has been closed, perform associated cleanup. cleanup(restarting) ; } httpd factory Indexer root manager

20 How Jigsaw Works? When there’s an incoming connection request, the httpd thread uses the client pool to handle the request.When there’s an incoming connection request, the httpd thread uses the client pool to handle the request. httpd factory Indexer root manager /archives/index.html SocketClientFactory handleConnection()

21 How Jigsaw Works? SocketClientFactory maintains a pool of SocketClients. It first either finds a free SocketClient thread in the pool, if available, or kills some old connections to get a free SocketClient, if the load have not exceeds the max-load.SocketClientFactory maintains a pool of SocketClients. It first either finds a free SocketClient thread in the pool, if available, or kills some old connections to get a free SocketClient, if the load have not exceeds the max-load.

22 How Jigsaw Works? When the Factory find a free SocketClient, it bind the incoming socket to the SocketClient, and the SocketClient will starts a thread to perform the request.When the Factory find a free SocketClient, it bind the incoming socket to the SocketClient, and the SocketClient will starts a thread to perform the request. Because all the SocketClients run as threads, when a connection is bound to a SocketClient, the server can keep on listening on the net for new incoming requests.Because all the SocketClients run as threads, when a connection is bound to a SocketClient, the server can keep on listening on the net for new incoming requests.

23 How Jigsaw Works? Then the SocketClient will process the incoming request, and calls the httpd’s perform(Request) method to lookup for the necessary resources. The perform method will return back a object containing all the resources needed to reply the request. SoketClient uses this object to send back the request result.Then the SocketClient will process the incoming request, and calls the httpd’s perform(Request) method to lookup for the necessary resources. The perform method will return back a object containing all the resources needed to reply the request. SoketClient uses this object to send back the request result.

24 How Jigsaw Works? After the request is replied, the SocketClient close the connection and return itself to the free SocketClient pool in the SocketClientFactory.After the request is replied, the SocketClient close the connection and return itself to the free SocketClient pool in the SocketClientFactory.

25 Some Notices on Jigsaw Jigsaw uses a thread pool (cache) to handle incoming request, instead creates a new process or thread to deal with it.Jigsaw uses a thread pool (cache) to handle incoming request, instead creates a new process or thread to deal with it. Jigsaw caches requested resources in a resource hashtable according to the resource id, in order to reduce file system access.Jigsaw caches requested resources in a resource hashtable according to the resource id, in order to reduce file system access.

26 Some Notices on Jigsaw When the httpd is looking up the requested resource, if it is a read only request, it will only increase the lock number (reference number) of that object, so one resource can be accessed simultaneously by multiple request.When the httpd is looking up the requested resource, if it is a read only request, it will only increase the lock number (reference number) of that object, so one resource can be accessed simultaneously by multiple request.

27 Some Notices on Jigsaw Jigsaw also uses some LRU algorithm to discard long-unused resources in memory. And also kills long idle connection and SocketClient to decrease the server’s work load.Jigsaw also uses some LRU algorithm to discard long-unused resources in memory. And also kills long idle connection and SocketClient to decrease the server’s work load.

28 Some Notices on Jigsaw It does not provide direct configuration method to run it on multi-machines cooperatively. But its internal design makes it possible to replace or add some of its classes to gain new functions.It does not provide direct configuration method to run it on multi-machines cooperatively. But its internal design makes it possible to replace or add some of its classes to gain new functions.

29 End of Jigsaw

30 High-performance Web Servers in other institutes JAWS---An Web Server in CS Dept., Washington UniversityJAWS---An Web Server in CS Dept., Washington University –JAWS’s findings: “Factoring out I/O, the primary determinant to server performance is the concurrency strategy”“Factoring out I/O, the primary determinant to server performance is the concurrency strategy” “For single CPU machines, single-threaded solutions are acceptable and perform well. However, they do not scale for multi- processor platforms. ““For single CPU machines, single-threaded solutions are acceptable and perform well. However, they do not scale for multi- processor platforms. “

31 High-performance Web Servers in other institutes –JAWS’s findings: Process-based concurrency implementations perform reasonably well when the network is the bottleneck. However, on high-speed networks like ATM, the cost of spawning a new process per request is relatively high.Process-based concurrency implementations perform reasonably well when the network is the bottleneck. However, on high-speed networks like ATM, the cost of spawning a new process per request is relatively high. Multi-threaded designs appear to be the choice of the top Web server performers. The cost of spawning a thread is much cheaper than that of a process.Multi-threaded designs appear to be the choice of the top Web server performers. The cost of spawning a thread is much cheaper than that of a process.

32 High-performance Web Servers in other institutes –JAWS’ Framework Overview:

33 High-performance Web Servers in other institutes –“... the key to developing high performance Web systems is through a design which is flexible enough to accommodate different strategies for dealing with server load and is configurable from a high level specification describing the characteristics of the machine and the expected use load of the server.” –More on JAW: http://www.cs.wustl.edu/~jxh/research/resear ch.htmlhttp://www.cs.wustl.edu/~jxh/research/resear ch.htmlhttp://www.cs.wustl.edu/~jxh/research/resear ch.htmlhttp://www.cs.wustl.edu/~jxh/research/resear ch.html

34 High-performance Web Servers in other institutes Scalable Web Server Architecture from Lucent & UT AustinScalable Web Server Architecture from Lucent & UT Austin

35 High-performance Web Servers in other institutes Scalable Web Server Architecture from Lucent & UT AustinScalable Web Server Architecture from Lucent & UT Austin –Redirection Server is used –Data is distributed among the servers –Problem occurs on constantly moving docs

36 High-performance Web Servers in other institutes Web Server Clusters in UCSBWeb Server Clusters in UCSB –Master/Slave Architecture

37 High-performance Web Servers in other institutes Web Server Clusters in UCSBWeb Server Clusters in UCSB –Masters handles static requests. –Dynamic content requests may be processed locally at masters, or redirected to a slave node or another master. –Slaves may be either dedicated or non- dedicated.


Download ppt "CHEN Ge CSIS, HKU March 9, 2000. Jigsaw W3C’s Java Web Server."

Similar presentations


Ads by Google