Using CDNs to Reduce Network Latency

Using CDNs to Reduce Network Latency

There are two definitions that can be understood from network latency. In relation to overall network performance, latency is the number of milliseconds for your web content to begin rendering in a visitor’s browser.

In relation to network computing, latency is the time taken for a site visitor to make an initial connection with your webserver.

So, by minimizing latency, you will be able to correspondingly reduce page loading time and enhance your site visitor’s experience. Therefore, minimizing latency is highly recommended to any e-commerce sites. If you are a web developer this article will fit you.

How to Measure Latency

There are several methods that you can use to measure latency, such as:

Round-trip time: with Ping, you can measure a round trip time, Ping is a command line tool that bounces a request off a user’s system to any targeted server. RTT is determined by the interval it takes for the packets to be returned to the user.

Network congestion or throttling can occasionally provide a false reading, while the ping value provides a reliable assessment of latency.

Time to first byte (TTFB): After the webserver gets an initial user request, the time taken for the visitor’s browser to begin rendering a requested page is known as time to first byte (TTFB). There are two ways to measure it:

  • Actual TTFB: The amount of time taken for the first data byte from your server to reach a visitor’s browser. Network speed and connectivity affect this value.
  • Perceived TTFB: The amount of time taken for a site visitor to perceive your web content as being rendered in their browser. The time it takes for an HTML file to be parsed impacts this metric, which is critical to both SEO and the UX.

 How CDNs Reduce Your Network Latency

To reduce network latency, you can apply CDNs which work in several ways, such as:

  • Content caching: you can get this benefit through a CDN’s global network of strategically placed points of presence (PoPs); exact copies of your web pages are cached and compressed. As your site visitors are generally served content from the PoP closest to their location, this will greatly decrease RTT and latency.
  • Connection optimization: it is a session reuse and network peering that optimize connections between visitors and origin servers.
  • Progressive image rendering: For any image, a progressive series is overlaid over one another in the visitor’s browser. Each overplay is of a higher quality resolution. The visitor’s perception is that the page is being rendered more quickly in their browser than it would be otherwise.

Reducing the network latency is very important in maintaining your website in its best quality, as it determines your website’s performance and how it can attract more visitors. With these tricks, you can make an awesome website without having to worry too much about slow page loading time problems.

introduction of JDBC Connection Pooling

jdbc-connection-pooling

This article will tell you about how web developers can provide a strategy for applications that must handle connection pooling. This document will give an overview of JDBC connection pooling as specified by the JDBC 3.0 specification. This Connection Pool Manager is shipped with DataDirect Connect® for JDBC and DataDirect SequeLink® for JDBC. Finally, this document provides an example showing performance benchmarks that demonstrate the performance benefit by using connection pooling.

Connection Pooling

On the other side, establishing JDBC connections can be resource-expensive. Especially, when the JDBC API is used in a middle-tier server environment, or when DataDirect Connect for JDBC or DataDirect SequeLink for JDBC is running on a Java-enabled web server. In this condition, when connection pooling is used performance can be improved significantly. Rather than created connections each time a connection is requested, connection will be reused in Connection pooling. A connection pool works by a connection pooling module as a layer on top of any standard JDBC driver product.

Connection pooling will not affect how an application is coded as it will be performed in the background. However, the application must use a DataSource object (an object implementing the DataSource interface) in order to obtain a connection instead of using the DriverManager class. A class implementing the DataSource interface may or may not provide connection pooling. A DataSource object registers with a JNDI naming service. After a DataSource object is registered the application will retrieve it in the standard way from the JNDI naming service.

For example:

Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup(“jdbc/SequeLink”);

The lookup returns a connection from the pool if one is available, if the DataSource object provides connection pooling. However, if there is no connection pooling or if there are no available connections in the pool, the lookup creates a new connection. The application will get advantages from connection reuse without the need to change any code. In fact, reused connections from the pool act the same way as newly created physical connections. Connection to the database and data access works in the usual way with the application. Furthermore, the application explicitly closes the connection, when the application has finished its work with the connection.

For example:

Connection con = ds.getConnection(“scott”, “tiger”);
// Do some database activities using the connection…
con.close();

For future reuse, the pooling module will get signal from the closing event on a pooled connection signals to place the connection back in the connection pool.