Designing & Comparing Centralized TCP File Server with ... - CiteSeerX

4 downloads 75266 Views 526KB Size Report
Keywords: Network file server, Multicasting, Unicasting, Java Socket, Java ... Standalone system where a dedicated server is responsible to handle all clients ...
Int. J. Emerg. Sci., 2(2), 268-279, June 2012 ISSN: 2222-4254 © IJES

Designing & Comparing Centralized TCP File Server with TCP & UDP based Enhanced Unicasted and Multicasted Multimedia File Servers Arun Singh1, Ajay K Sharma2 and Ashish Kumar3 Dr. B.R. Ambedkar NIT Jalandhar, India [email protected],[email protected], [email protected]

Abstract. Paper describes a Centralized Network File Server supporting multiple clients at a time and responding their queries of multiple formats files like txt, docx, pdf, htm, jpeg, mp3, mp4 and flv etc. The server is implemented in three scenarios, first using simple TCP protocol in java socket, where client request is directly send to server and processed, while in second and third scenario server unicast and multicast list of files present at the server to each client. In unicasting the client will receive a single copy of file list, when it makes connection with the server. While in multicasting, each client whom is a member of multicasting group will receive a copy of file list each time a new client makes connection with the server or after a period of time. The client request is first verified and validated against server file list, at its end and then sends to server. The system is analyzed and compared on the basis of Heap memory usage and bandwidth utilization for server processing and data communication, when connected with 2, 4 and 8 number of clients. Keywords: Network file server, Multicasting, Unicasting, Java Socket, Java Server and File Server.

1.

INTRODUCTION

With the rapid development of network technologies and the continual decrease of cost, brings the computer network to get tested at each step for better performance and efficiency. Open system interconnection (OSI) model [1, 2] is a concept that describes how data communication takes place in a computer network. OSI model consist of seven layers each performs a set of function on data during communication. Transport layer [3, 4] is the fourth layer of OSI reference model which provides transparent transfer of data between end systems, using TCP (Transmission Control Protocol) [5, 6] or UDP (User Datagram Protocol) [7]. TCP is a connection Oriented protocol which sends a acknowledgement after receiving each packet during communication these packets are arranged in a order at receivers end, as send by sender. If any packet or its acknowledgement is lost during communication, the respective packet is resend to receiver. UDP is a connection less protocol where packets are just sends by sender without bothering about its

268

Arun Singh, Ajay K. Sharma and Ashish Kumar

acknowledgment, the receiver will arrange the packets in order of receiving. Hence UDP is said to be less reliable but faster in communication [8] [9]. In recent years Java has become the most prevalent language [10], which provides a rich and robust set of application program interfaces to the network. These include datagram packets TCP ObjectStreams, DataStreams, and remote method invocation (RMI) [11]. At the lowest level, all the TCP based protocols act as a genetic byte stream. Java enhances the capabilities of the genetic byte streams by layering I/O classes that transmit data over the streams in different manners. Standard byte streams have the ability to transmit one byte or a block of bytes. DataStreams can transmit serialize primitive data types, arrays and Strings into sequence of bytes before transmission. ObjectStreams serialize entire object into byte streams for transmission [12].Sun Microsystems launch jdk 1.1 having java.net package consisting of ServerSocket and Socket classes for data transfer using TCP protocol, while DatagramPacket and DatagramSocket classes for UDP data transfer and special feature of multicasting to a specified group of users by using MulticastSocket() method [13, 14]. UDP has a very basic and simplified header which has only 8 bytes of overhead as compared to 20 bytes in TCP. UDP is considered to be very useful in some circumstances especially in speed and network management hence we use it for transporting server data file list to each client.

2.

SYSTEM DESCRIPTION

2.1 Centralised Server using only TCP protocol

Standalone system where a dedicated server is responsible to handle all clients and responsible to query them is designed and developed, where client can ask for all types of files like txt, docx, pdf, mp3, mp4, flv etc. The server receives the request and searches file in its database if file is present with the server it will response with a copy of file otherwise a “no” message is sent to client. The centralized server waiting for client is shown in Figure1 and requesting client is shown in Figure2. The Java code to establish TCP server is as, public class ts implements Runnable{ Socket S; ts(Socket S) { this.S=S; } ServerSocket SS = new ServerSocket(8000); Socket S1 = SS.accept(); new Thread(new ts(S1)).start(); Public void run() { //Code to server muticlients at single instance }

269

International Journal of Emerging Sciences 2(2), 268-279, June 2012

Java Code for responding client request is as, File myFile = new File("d:\\"+name of File Requested); FileInputStream fis = null; OutputStream out = null; try { fis = new FileInputStream(myFile); } catch (FileNotFoundException e1){ } BufferedInputStream bis = new BufferedInputStream(fis); try { bis.read(read file in Buffer array); //reads bytes from input stream into array Buffer out = S.getOutputStream();//output stream of bytes out.write(write file in Buffer array); out.flush(); } catch (IOException e1){ } Thread.sleep(50); //To wait for writing stream synchronization S.close();//To disconnect the connection }

Figure 1. Centralized Server in waiting state.

270

Arun Singh, Ajay K. Sharma and Ashish Kumar

Figure 2. Client requesting for file

2.2 Centralised Server using TCP protocol and UDP Unicasting

The same centralized TCP server but with enhanced functionality of sending list of files present at server, to each connecting client by using UDP unicasting. The server composed of dedicated folder consisting all files meant for sharing on network and a self maintained and manageable list, containing name of each file present in that folder. As the new client make connection with the server, server accept client connection after client authentication and sends server file list to only this connecting client, hence called file list unicasting. The working model of server/client is shown in Figure 3 and java code of unicasting list of files at server is written as, Public void run() { uaddress=InetAddress.getByName("10.10.54.181"); // Name of connecting client usocket=new DatagramSocket(); String uname="d:\\filename.txt"; /*filename.txt contains names of files present at server And shown in Table 1.*/ File umyFile=new File(uname); byte[] ubuf; FileInputStream ufis=null; OutputStream uout=null; ufis=new FileInputStream(umyFile); BufferedInputStream ubis=new BufferedInputStream(ufis); ubis.read(File in Array Buffer); upacket=new DatagramPacket(Buffer array, its length, client address); usocket.send(upacket); }

271

International Journal of Emerging Sciences 2(2), 268-279, June 2012

Figure 3. Working Model of file list Unicasting

The proposed model, let the client to check for file availability at its site, while in previous case number of times client sends ambiguous file request and makes server busy in searching file at its end and then responding back with “no” message. Table 1. Server File List

Raam.mp4 Arun.pdf Bbc.avi BBS.java Google.htm Gp.jpg Ps.mp3 Rs.flv b.flv Sf.docx T1.txt 2.3 Centralised Server using TCP protocol and UDP Muticasting

Again, the same centralized TCP server but here server multicast list of files present with it. Each time a new client makes connection with the server or after every 24 hours, server multicast file list containing names of files present at server for sharing at network, to each client having connection with the server. This helps the clients to remain update and useful for applications where server files are updating

272

Arun Singh, Ajay K. Sharma and Ashish Kumar

after short interval of time. The working model of client/server is shown in Figure4 and code of multicasting file list is written in java as, dd1=(new Date()).toString(); // Get the system Date try{ String dd2=(new Date()).toString(); //get the date of client connection if(!(dd1.equals(dd2))){ uaddress=InetAddress.getByName("228.5.6.7"); //Get the name of client making connection usocket=new MulticastSocket(); //assigning Multicast Socket usocket.joinGroup(uaddress); //assigning multicasting Group String uname="d:\\filename.txt"; //File containing names of server files File umyFile=new File(uname); byte[] ubuf; FileInputStream ufis=null; OutputStream uout=null; ufis=new FileInputStream(umyFile); BufferedInputStream ubis=new BufferedInputStream(ufis); ubis.read(File in Array Buffer); upacket=new DatagramPacket(Buffer array, its length, client address); usocket.send(upacket); usocket.disconnect(); usocket.close(); } } catch(Exception ex){}

Figure 4.Working model of file list Multicasting

273

International Journal of Emerging Sciences 2(2), 268-279, June 2012

3.

RESULTS AND DISCUSSIONS

The implemented server is tested on Systems with Intel(R) Pentium Processor(R) D CPU 2.80 GHz 2.79 GHz, 1.25 GB Ram, Windows 7 (32 bit) Operating System. The server contains a dedicated folder to respond to all client requests, the file contained in a folder composed of various extensions and sizes, as stated in Table 2. The clients have permission only to copy file in a dedicated folder, hence secured. Table 2. The Server Repository

File Extension

File size

Txt Java Docx PDF HTM MP3 MP4 FLV AVI JPEG

822 Bytes 1.99 KB 13.0 KB 52.0 KB 19.4 KB 6.80 MB 10.1 MB 1.6 MB 3.4 MB 92.0 KB

3.1 Heap Memory Utilization

Heap Memory Usage (MB)

The Heap Memory utilized by CPU running the server with respect to time (in seconds) [15] elapsed in making connection with clients, searching file at in its repository and then fulfilling the respected request is drawn for simple TCP Centralized server, file list unicasting Centralized server and file list multicasting Centralized server for 2, 4 and 8 number of client connections. 100

80

80 60

43.7 47 48

50 52

63

54 56

40 20 0 2

4

8

Number of Clients Centrlized

Unicasting

Figure 5.Heap Memory Utilization (MB)

274

Multicasting

Arun Singh, Ajay K. Sharma and Ashish Kumar

Heap Memory utilization is increasing with increase in number of client connections. Heap Memory utilization for file list unicasting is slightly more than simple Centralized server, because server has to perform additional task of maintaining server file list and unicasting it to client at time of making connection. This heap Memory utilization increases drastically for file list multicasting, because here server has to perform file list multicasting to each client, whenever a new client makes respective connection. 3.2 Total Classes Loaded

Total Classes Loaded

Total classes loaded increases with increase in number of client connections. Classes loaded in case of unicasting server is more in number from centralized server, due to initialization of more I/O stream connection for file list unicasting to each new client. This classes loaded is much more in number for file list multicasting server because of I/O file stream initialization for each file multicasted to a group and its respective member for each time any client makes a connection with the server [16]. 1371

1400 1350 1300 1250

1221 1234

1242

1247

1278

1300

1295 1248

1200 1150 1100 2

4

8

Number of Clients Centrlized

Unicasting

Multicasting

Figure 6.Total Classes Loaded

3.3 Percentage of CPU Usage

Figure 7 shows the percent of CPU usage [17] in making connection with the client, searching file at its end and then responding back to client, for simple centralized server, file list unicasting and multicasting centralized server. Percentage of CPU usage increases with increase in number of client connections. This percentage of CPU usage is always large for simple centralized server for equal number of client connection. This is because simple centralized server makes connection with client and search for file requested by client at its site, this searching of file also include lots of file which are not present with the server

275

International Journal of Emerging Sciences 2(2), 268-279, June 2012

hence ambiguous and of no use. This ambiguous file search make server busier and hence increase its utilizations, so Unicasting file list server is better performed. In case where server repository is updating in short interval of time or dynamically, there file list unicasting fill fail or imposed less effects. In this case clients have to update its data sheet immediately or within a short interval of time to cope with practical requirement and ask from server only those files which are present with it. In our case its shows no much difference in CPU usage because repository is not changing as much frequently as it has to be.

CPU Usage (%)

8

7

6 4

3.5

2.8 2.8

4.2 3.8 3.6

4

4

8

3

2 0 2

Number of Clients Centrlized

Unicasting

Multicasting

Figure 7.Percentage of CPU Usage

3.4 Total Threads Invoked

Total numbers of thread invoked again increases with increase in number of client connections, and much with usage of more I/O stream utilization for file list unicasting and multicasting. The number of Java Threads invoked depends much on java library used and multitasking involved [18, 19], hence there is slight difference for all three for same number of client connections.

276

Total Number of Threads Invoked

Arun Singh, Ajay K. Sharma and Ashish Kumar

44 47

50 40

29

30 20

17

22 23

32

34

22

10 0 2

4

8

Number of Clients Centrlized

Unicasting

Multicasting

Figure 8.Total Number of Threads Invoked

3.5 Network Bandwidth Utilization

Network Bandwith Utilization (MB)

Bandwidth utilization [20] increases with increase in number of client connections and their requests. For same number of clients its least for simple centralized server because here server will only send the requested file or “no” message in the network. In case of unicasting file server the network will be busy by file requested and server file list Unicasted once to each connecting client, while in case of multicasting server, server file list is multicasted each time to each client which is connected with the server when new client make connection with it or dynamically after a period of time interval, hence shows maximum bandwidth utilization for same number of clients and this increases more drastically with increase in number of clients. 14

15 10 5

6.8

6.5

7.7

9.3

8.2

10

2.9 3.8

0 2

4

8

Number of Clients Centrlized

Unicasting

Figure 9. Network Bandwidth Utilization (MB)

277

Multicasting

International Journal of Emerging Sciences 2(2), 268-279, June 2012

4.

CONCLUSIONS

The need of file in a network is well known and well fulfilled by our centralized TCP server. Now it depends upon requirement and set a tradeoff between CPU utilization and Bandwidth utilization, keeping other things constant for usage of same java library and functionality. Now the requirement of client and environment of his working will set the server for him. If environment composed of large bandwidth data lines but less powerful CPU‟s, then our file list unicasting model will suites it, but if files at server is updating in short period of time and dynamically then multicasting server suites best. The environment where server is established with high capacity CPU‟s using parallelization for responding client request in narrowband network connection then centralized server has to be established there.

REFERENCES 1. 2. 3. 4. 5. 6. 7. 8.

9. 10.

11. 12.

13.

The OSI Reference Model. [http://www.thecertificationhub.com/networkplus/the_osi_ref_model.htm](14/01/2010). Andrew S Tannenbaum, “Computer Network”, Edition 4 th, Dorling Kindersley, 2006, pp487-557. TCP/IP Transport Layer Protocols. [http://www.tcpipguide.com/free/t_TransportLayerProtocols.htm](01/02/2010). Transport Layer Protocol. [http://www.erg.abdn.ac.uk/users/gorry/eg3561/inetpages/transport.html](03/02/2010). Zhao-na Zheng and Peng Sun, Design and Implementation of Chat room using UDP, FCC 2009, CCIS Volume 34 pp 235-239, 2009. R. Stevens. TCP/IP Illustrated, Volume 1: The Protocols. Addision-Wesley, Jan. 1994. J. Postel, “Transmission Control Protocol”, IETF RFC 793, Sep. 1981. Eitan Farchi, Yoel Krasny, and Yarden Nir, “Automatic Simulation of Network Problems in UDP-Based Java Programs”, Proceedings of the International Parallel and Distributed Processing Symposium, 2004 IEEE. Elliot Rusty Harold, “Java Network Programming”, Edition 3 rd, O‟REILLY, 2008, pp610-640. Akshit Malhotra, Vaibhav Sharma, Prateek Gandhi and Neetesh Purohit, “UDP Based Chat Application”, 2nd International Conference on Computer Engineering and Technology, 2010 IEEE. TIOBE Programming Community Index for November 2007, DOI=http://www.tiobe.com/tpci.htm. Mark Pendergast, “Performance, Overhead, and Packetization Characteristics of Java Application Level Protocols”, Research in Information Technology (ISBN:1944-0278), Vol 8, Number 1, January 2011. Pendergast, M.O., “Evaluation of Application Level Communication Protocols for Networked Java Applications”, Proceedings of the 8 th International Conference on

278

Arun Singh, Ajay K. Sharma and Ashish Kumar

14. 15.

16.

17. 18. 19.

20. 21.

Computing Communications and Control Technologies (CCCT 2010). Orlando, FL, April 2010. Mahmoud, Q.H., 2001, “Advanced Socket Programming”, Sun Developer Network, December 2001, DOI=http://java.sun.com/developer/technicalArticles/RMI/rmi_corba/ Sun MicrosSystems, 2006, “Java Networking Overview”, Sun Developer Network, 2006, DOI=http://download.oracle.com/javase/6/docs/technotes/guides/net/overview/overvie w.html Shlomit S. Pinter, Yariv Aridor, Steven Shultz, Sergey Guender, “ Improving Machine Virtualization with „Hotplug Memory‟ ”,Proceedings of the 17 th International Symposium on Computer Architecture and Hogh Performance Computing (SBACPAD‟05), 2005 IEEE. LI GONG from Sum Microsoft, “Secure Java Class Loading”, 1998 IEEE. Hai-Shuan Lam, G.S.V.R.K Rao, Chikkanan Eswaran, Kok-Seong Ng, “Performance Comparison of various Garbage Collectors on JVM for Web Services”, 2006 IEEE. Richard Jones, Andy C.King, “A fast Analysis for Thread-Local Garbage Collection with Dynamic Class Loading”, Proceedings of the 2005 Fifth IEEE International Workshop on Source Code Analysis and Manipulation (SCAM‟05), 2005 IEEE. Arabi E.Keshk, “Implementation of Distributed Application using RMI Java threads”, 2007 IEEE International Symposium on signal processing and Information Technology. Nobuyoshi Tsuboi, “A Proposal of TCP Congestion Control Scheme Suited for Bandwidth Reservation Network”, IEEE ICC 2006.

279

Suggest Documents