Browse Prior Art Database

Statistical method for scaling memory usage in Java servlet-based web server architecture

IP.com Disclosure Number: IPCOM000005818D
Publication Date: 2001-Nov-08
Document File: 3 page(s) / 1K

Publishing Venue

The IP.com Prior Art Database

Abstract

Disclosed is a statistical method for scaling memory usage in Java servlet-based web server architecture. Benefits include improved efficiency of memory allocation for string handling and improved server utilization.

This text was extracted from a Microsoft Word document.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 50% of the total text.

Statistical method for scaling memory usage in Java servlet-based web server architecture

Disclosed is a statistical method for scaling memory usage in Java servlet-based web server architecture. Benefits include improved efficiency of memory allocation for string handling and improved server utilization.

      The disclosed method pertains to the usage of memory in a Java servlet-based web environment, and involves using historical data gathered in usage to determine the optimal amount of memory to allocate for strings. In general, the largest share of memory allocated by a Java servlet during the course of operation on a web server is occupied by strings. Servlets typically generate large strings of HTML code for display as the result of an HTTP query to the web server. This memory usage rapidly becomes extremely inefficient in the presence of large HTML string buffers because of the memory allocation scheme used by the Java language runtime, so it becomes useful to develop an alternative method for determining how best to allocate memory for string buffers at runtime.

      When a string object is declared in the Java language, an associated string buffer is created which holds the physical storage space for the string’s characters. This string buffer is created at a default size if the initial size is not specified in the Java code. When the string buffer is filled and more space is needed, the Java runtime doubles the length of the string buffer, incurring the overhead of both a memory allocation and potentially using considerably more memory than necessary. For example, a string that was 4097 characters long would typically have an underlying string buffer that was 8 KB (8192 characters), a waste of 4095 characters. A typically loaded web server can have as many as 100 or more active HTTP sessions. Each can typically contain approximately 100 strings of which any can reach 30-40 KB, yielding a total allocated but unused string space of (32 KB)*10,000=320 megabytes. Reducing this amount approximately by half would result in the capability for a web server to handle double the traffic load before experiencing memory shortages. If every string were allocated at run time by twice its actual length, preallocation would save almost 50% of memory usage with practical, typical savings of 25%. 

      The conventional approach used to minimize the effect of this feature of Java is pre-allocation. A calculation or estimation of the size of an average stri...