Skip to main content

Application Network Performance Tunnig

This post shares some the factors that need to be considered while designing an application that is going to be accessed using a network having high latencies and low bandwidth. The post will also look at some of the important TCP level tuning factors.

Symptom

The application works well when accessed from some locations and from some other locations its very slow.

Possible causes

Network Issues
  • Network is having high latency
  • Bandwidth is very narrow
  • Packet loss is high
Application design related
  • Multiple calls to server
During design itself avoid using multiple server calls to fulfill a business process.
From the client issue a single call to the server and let the server do the processing and return the desired objects in this call.
  • Unnecessary transfer of data
Re look your design/code and find out whether you are transmitting data that's not of
importance to the client. Reduce all unnecessary data transfer to the client.
  • Sending large chunks of uncompressed data
Using different compression algorithms compress the data before sending to the client. Gzip
compression is a good option. But compression can be CPU intensive ; so the capacity planning should consider this factor also.
  • Not Caching Master Data
Look at the possibility of caching the data that's not changed frequently.

TCP Related
TCP's slow start and congestion control issue :-

TCP starts a session by sending two packets at a time and waiting for acknowledgment.TCP increases its connection window one packet at a time until it receives congestion signal.when it recognizes a congestion signal;it reduces the current send window size to half and then resumes additive increase.This increase happens one packet at time until congestion window equals advertisedWindow or a till a congestion signal is received.

This TCP behavior results in an oscillating send window and it affect the effective utilized capacity of a TCP connection. Large TCP Advertised window is an option to tune this behavior.
This better done by an OS expert.

TCP Window Size:-

TCP has a window of packets that can be in flight from one network end to another.If the window is full ; the sender cannot send additional packets until the destination acknowledges the receipt of some of the already sent packets. Since on a high latency network the acknowledgment takes a long time to come; the transmission from the sender is halted when the window is full until ack comes for the packets already send. This can be a problem.
The possible solution is to increase the TCP window size. The default value of this is 64 KB.
A lot of optimizations on this TCP behavior is done at the OS level in many new OS; like Windows Vista.


Comments

Anonymous said…
Interesting to know.

Popular posts from this blog

Java - Too Many web frameworks

Hmm......... Java Web technology is exploding with many web frameworks promoted by the industry and many by opensource. Too many frameworks to choose from is a bad thing or good thing ?. Read on and judge yourselves. May be too much of anything is bad. Just look at the list below. JSF Spring MVC Tapestry Struts 2 ADF from Oracle Cocoon Maverick JBoss seam This is a never ending list. There are many more. Ofcourse not all are mainstream nowadays. Look at Microsoft stack , you mainly have ASP .NET and that's it. It has grown well.You need to learn only that and you focus all your skills in that web framework.It has accumulated many components and matured into a very robust RAD web application framework. The problem with the Java stream is you work on a particular web framework for sometime and all of a sudden you have to work in another web framework for another project.Hence the experiance one gains by working in a particular framework for long time, gets lost. This definitly lowers...

Using Database login Module in JBoss

This post is a detailed description on how to use the database login module in JBoss with a J2EE Application. Scenario There is a EJB and we want to restrict the access to this ejb's method to an authenticated user having a particular role. The EJB is accessed from a standalone Java Client using Remote Lookup. Implementation The EJB is HelloSSB and the roles allowed are admin and user. First step is to write the EJB The source code is given below. This is a stateless session bean. package com.prem.ejb; import javax.annotation.PreDestroy; import javax.annotation.Resource; import javax.annotation.security.RolesAllowed; import javax.ejb.SessionContext; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.jboss.annotation.security.SecurityDomain; @Stateless @SecurityDomain ("helloworld") public class HelloSSB implements HellioIntf{ @PersistenceContext(unitName = "EntApp") EntityManager em; @Reso...