Improving Performance

Your web presence is growing! Traffic and usage are escalating and you have to maintain a superior level of performance. The state of growth unfolds many opportunities but it also holds challenges as a result of change. Not only does performance affect your operating costs, it also reflects directly on the end-user experience. The marketing and sales departments are probably saying that happier users directly increase sales.

Unsatisfactory user experience can be traced back to any of several reasons:
  • Reduced response time due to increased request/seconds on the HTTP server
  • Reduced response time due to increased hits to the database
  • Slow download speed due to users dialing-up with slow connections
  • Undesired visitors are hacking your site
  • Errors as a result of adding software to the site
  • And others
Successful growth doesn’t happen immediately, it is a constant cycle of evaluation and change– identifying points of fault, reporting, decision making and implementing a solution.

Improving Performance
Implementing homegrown solutions to deal with identified issues internally often results in a patchwork of disparate systems or solutions either developed internally or purchased separately. The amount of investment needed to tackle all issues effectively at once is too great and requires major investment in critical resources such as capital and personnel.

This article will only attempt to tackle performance improvement, the first step in the cycle of growth discussed in the figure above. I will present several techniques available in the market addressing the issue of performance improvement.

Caching – What is it?
A cache is disk memory that is set aside as specialized buffer storage that is continually updated. Temporary files, such as HTML documents, are stored in the cache that is optimized for fast read-and-write access to short-lived data.

Caching is a word widely used to describe various solutions that rely on the concept of Cache. These solutions provide increased performance and scalability for Web sites. Caching solutions can be grouped as following: Proxy caching, Server-side caching and Client-side caching. The type of content to be stored is the primary factor for determining the best caching option for a Web site.

While Proxy caching is the traditional caching technique, server side caching is becoming increasingly popular as a dynamic information caching method.

{mospagebreak title=Static and Dynamic Web content}
When the World Wide Web was in its infancy, it consisted of primarily static information. Dial-up connections were slow, which was fine because online traffic was light. Since those early years, the Internet has changed dramatically-with content becoming increasingly dynamic.

Dynamic content evolved as a result of the desire to increase interactivity on the Internet. Dynamic content reflects information that can change with every user request. The content is a result of the server-side execution of a set of instructions hidden within the requested page. Once the code is executed and a static HTML page is created and received by the browser, the web server discards the results from memory. Database-driven Web sites, such as news portals or e-commerce portals, are typical examples of dynamic content sites. Dynamic content puts a heavy load on the Web server due to the immense processing power required to produce dynamic results for thousands of requests in real time. Database servers are also hard at work providing the dynamic data to these Web servers.

Proxy caching

Forward Proxy cache
Forward Proxy caching is deployed in front of web browsers for an enterprise’s internal user’s access. The cache stores frequently requested content and when users access external Web information, instead of going across the Internet, the cache delivers the stored content from a closer proximity. For example, if, and are widely accessed by the employees, the forward proxy cache would hold a copy of these files (see figure 1 below).

This technique provides accelerated performance for the company’s internal users and conserves the external bandwidth cost related to retrieving the documents from the Internet. The forward proxy cache is not related at all to the Web server performance.

{mospagebreak title=Reverse Proxy cache}
Reverse Proxy caching is used by enterprises when dealing with static, unsecured Web content. Reverse proxy caching is deployed in front of the web server for external user access. Requests for content to an internal Web server are filtered through the Reverse proxy cache before they reach the source Web server, thereby offloading traffic to the web server. Reverse proxy caches, which store the frequently requested data, are optimized to serve Static data quickly.

When a client browser makes an HTTP request, the DNS will route the request to the reverse proxy machine, not the actual web server. The reverse proxy will check its cache to see if it contains the requested item. If not, it connects to the real web server and downloads the requested item to its disk cache. The reverse proxy can only server cacheable URLs (such as html pages and images). Therefore, Reverse proxies are ideal for caching unsecured, static content.

Server-side caching
Dynamic content caching
As content becomes more dynamic, powerful Web servers are required to handle increasing user demands. Additionally, bandwidth capacity continues to grow as businesses move more and more of their applications on-line. With these ever-increasing needs, server-side caching emerges as the best response to the tremendous performance and scalability requirements of the modern-day Web site.

The simple technique of dynamic content caching can improve both Web site performance and scalability quickly and efficiently, by executing only necessary code on the Web HTTP server. A specifically designed filter between the server and the client caches the output of dynamic requests. Once the PHP code is executed and the HTML result is available, it is saved to the Web content cache. The cache filter detects subsequent requests to the same dynamic page and immediately responds with the cached output before these requests arrive at the Web server. The benefit is three fold: (1) Clients can receive requested HTML files much faster, (2) The Web server does not need to repeatedly execute the dynamic request, saving processor cycles for more productive work and (3) Reduces the amount of database queries executed, conserving overloaded resources.
Figure 2Dynamic Content Caching
Dynamic Content Caching

{mospagebreak title=Code caching (Acceleration)}
Code Acceleration is sometimes referred to as code caching. In fact it is very different from content caching because it caches the code and not the content. Code acceleration is at work when the server runs the script inside the PHP script engine.

By default, every time a PHP script is accessed, the script is parsed and compiled before it is executed. As long as the script does not change, parsing and compiling is redundant. Code caching maintains the compiled byte code version of the PHP script in memory, eliminating the need to parse and compile each time.

Code caching actively maintains the cached compiled scripts in a shared memory model, serving each process that is generated by the web server. For this reason, it is critical that the code accelerator be tightly integrated with the scripting engine, to ensure proper memory utilization and prevent failure.

Figure 3 – Code Acceleration
Code Acceleration

Query caching
In dynamic web sites, the database server is more likely to become the bottleneck since every query has to be processed and the quality of service drops dramatically under heavy load.

In query caching, the cache contains a list of recently executed queries and their results. Whenever possible, a new query is satisfied by results already stored in the cache, thereby avoiding potentially large data scans.

This technique benefits web applications that run complex, process intensive queries. For web applications that run frequent small-scale queries, the latency caused by the travel time over the network will most likely overshadow the benefit from query caching.

Figure 4 – Query caching
Query Caching

{mospagebreak title=Client-side caching}
Client-side caching is a feature that stores frequently used information on the client’s machine. It provides performance enhancements on the client side by allowing the client to quickly access a file that would have normally be accessed from a server.. Client caching is especially effective when the client disconnects from the server, in that case files can still be accessed from the local cache. Client-side caching is usually defined in the client’s browser settings.

Dynamic content caching maximizes performance and scalability
Dynamic content caching solutions address the scaling and performance issues of Web servers directly. They work well for heavily visited sites containing many dynamic features that must be tuned to respond quickly and easily. For a growing company anticipating reaching the Web server’s maximum processing power, dynamic content caching solutions will expand the Web server’s capacity more effectively than adding additional hardware to manage the load. In certain cases, server-side dynamic caching may be 20 to 100 times faster than processing the page normally.

Two factors to keep in mind when considering whether to cache dynamic pages include frequency of content changes and demand level for current content (hit count). Anticipated hit count determines the prioritization of pages to be cache. More popular pages take precedence over less frequently accessed pages. Some caching solutions provide analysis of script popularity on the site.

Full page caching
Full-page caching is the simplest and most straightforward dynamic caching mechanism. The user defines which page to cache and the server stores it in the cache disk space. In subsequent request for the page, instead of parsing the page, running the script and building the HTML page, the server will locate the existing cached page and send it to the client. The home page for a Web site is an excellent example of a popular page for full-page caching. Generally it is the first page that users see, the most frequently accessed and therefore has the greatest impact on the user experience. As mentioned, when using dynamic content caching the web server no longer creates pages for each request, but sends pre-built copies to the clients. Therefore, users do not see content changes once a page has been cached. Introducing the concept of ‘lifetime’ settings can solve this problem while still maintaining huge performance gains, even when set as low as two minutes. Lifetime settings permit the server to discard cached pages once their defined lifetime has expired, forcing the application server to reprocess the pages.

{mospagebreak title=Caching conditions}

Some sites use various parameters to recognize which version of the same page to serve. For example, the ‘Request’ parameter can be set so that it serves the appropriate page for Internet Explorer and Netscape browsers.

Full Page caching with conditions allows you to save distinct output based on the requesting URL query string or parameters such as: Get, Cookie, Request, Server and Session. Caching conditions can also be used to determine whether or not to serve identical requests from the cache. For example, has some pages that should be only cached when the end-user is not logged in. When the end-user is logged in, sets a cookie named Zend_In, signifying that the user has logged in. A caching condition can be set to cache the relevant pages only when the user is not logged in, in other words, ‘Zend_In’ is not set: -COOKIE:Zend_In.

It is important to note that some pages cannot be cached at all. Server-side script pages that process information submitted via an HTML form must be executed for every request and should never reside in a Web content cache. It may be useful to cache the form itself, especially if fields are populated from a database table.

Partial page caching
Partial caching provides greater flexibility and control for pages that contain both static and dynamic content. By selecting portions of the page to cache, only relevant parts of the page are cached while the dynamic content remains untouched.
Imagine the above store page containing current campaigns, general navigation, store navigation, Featured categories and My account including the shopping cart information. The entire page is static information collected from four database queries, except the My account section, which calls another database query. By caching the static queries and dynamically processing only the My account query, it is possible to save 80 percent of the original work for displaying the page.

Some server-side dynamic content caching solutions also implement page compression. This functionality removes all the remarks and white space inside the HTML that is sent to the clients. Additionally, the file can be zipped, reducing its size by as much as 80%. Compressed pages download much faster and further enhance the user’s experience.

Performance improvement is the first step in the cycle of growth. Even by itself it is a broad statement encompassing many concerns for network elements, each one calling for a different solution. As your site growth and you go through the growth cycle you will add to and modify your infrastructure. At each point, choose among the various caching solutions depending on the type of data your site servers and the location of the bottleneck.

[gp-comments width="770" linklove="off" ]

chat sex hikayeleri Ensest hikaye