WO2001095153A2 - A javatm virtual machine configurable to perform as a web server - Google Patents

A javatm virtual machine configurable to perform as a web server Download PDF

Info

Publication number
WO2001095153A2
WO2001095153A2 PCT/US2001/015946 US0115946W WO0195153A2 WO 2001095153 A2 WO2001095153 A2 WO 2001095153A2 US 0115946 W US0115946 W US 0115946W WO 0195153 A2 WO0195153 A2 WO 0195153A2
Authority
WO
WIPO (PCT)
Prior art keywords
request
virtual machine
recited
worker
data structure
Prior art date
Application number
PCT/US2001/015946
Other languages
French (fr)
Other versions
WO2001095153A3 (en
Inventor
Todd D. Turnidge
Original Assignee
Sun Microsystems, Inc.
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sun Microsystems, Inc. filed Critical Sun Microsystems, Inc.
Priority to AU2001263220A priority Critical patent/AU2001263220A1/en
Priority to EP01937489.1A priority patent/EP1364309B1/en
Publication of WO2001095153A2 publication Critical patent/WO2001095153A2/en
Publication of WO2001095153A3 publication Critical patent/WO2001095153A3/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/301Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is a virtual computing platform, e.g. logically partitioned systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/815Virtual
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/875Monitoring of systems including the internet

Definitions

  • the present invention relates generally to virtual machines. More specifically, it relates to enhancing a JavaTM virtual machine for allowing inspection and modification of the state of the virtual machine through configuring the virtual machine to perform as a Web browser.
  • JavaTM language and platform have become more widespread and their use is continually on the rise.
  • An increasing number of applications are written in the JavaTM language and are using a JavaTM virtual machine.
  • JavaTM applications are being used increasingly in components, such as Web appliances, set-top boxes, and other types of computing devices.
  • the use of the JavaTM virtual machine, needed to execute JavaTM applications increases, the demand for improving the development lifecycle of a JavaTM application and improving the efficiency of a JavaTM application becomes imperative.
  • Getting a better understanding of the performance of the JavaTM virtual machine is a step in this direction.
  • JavaTM virtual machines are seen as black boxes; opaque components that perform a crucial function but whose internal states are generally inaccessible to the users.
  • JavaTM application debugging some tools are available that allow those working in particular areas, for example, JavaTM application debugging, to get information on the state of a JavaTM virtual machine pertaining specifically to the task of debugging an application.
  • a debugging protocol it is possible to ask the virtual machine questions about its state without interfering with its other operations.
  • profiling protocols Another example is using profiling protocols to get specific information related to profile information.
  • virtual machines, methods, and computer- readable media are disclosed for configuring a virtual machine to operate as a web server so that users can inspect and/or modify the state of the virtual machine, such as a JavaTM virtual machine using their browsers.
  • a virtual machine configurable to function as a web server is described.
  • a browsable virtual machine has several components.
  • One component is a request handler worker that handles incoming queries relating generally to the virtual machine.
  • the request handler worker is an HTTP thread and the incoming request is in HTTP format.
  • the virtual machine has a library of services which can be used to construct responses to the requests.
  • a service is used to perform specific operations in the virtual machine to respond to the incoming query.
  • Another component is an operations worker for constructing output containing a reply to the incoming query.
  • the reply typically provides insight into or mutates the operation of the virtual machine.
  • a method of handling an incoming query into the state of the virtual machine or a query to mutate the state of the virtual machine is described.
  • Such a query will typically originate from a web browser.
  • a network traffic worker for receiving and transmitting requests and responses, respectively, is invoked.
  • This network traffic worker can be an HTTP thread for handling requests in HTTP format.
  • the request data structure is passed to a virtual machine operations worker which is responsible for constructing a response to the request.
  • the response may be passive information on the state of the virtual machine (e.g., memory allocations) or the response may be a mutation of the state of the virtual machine.
  • the response is then transmitted to the browser or user. This can be done by the network traffic manager.
  • FIG. 1 is an overview block diagram of how a browsable virtual machine operates in accordance with one embodiment of the present invention.
  • FIG. 2 is a block diagram of a JavaTM virtual machine enabled to function as a web server in accordance with one embodiment of the present invention.
  • FIGS. 3 A and 3B are flow diagrams of a process of implementing a web server in a JavaTM virtual machine in accordance with one embodiment of the present invention.
  • FIG. 4 is a diagrammatic representation of a virtual machine suitable for implementing the present invention.
  • JavaTM virtual machine that can perform as a web server as described in the various figures.
  • This web server when enabled in a JavaTM virtual machine, provides transparent access, or a small window, to the state of the JVM.
  • This "browsable VM” allows end-users to gather insights about their application and the application's runtime characteristics. The user can glean insights, for example, about where the application is spending its time during steady-state runtime (ignoring startup and shutdown overhead) in order to improve performance, as well as identifying potential memory inefficiencies.
  • information most useful to application and VM developers is either application monitoring information or information related to a JVM internal problem.
  • the JVM generates HTML pages, containing the information requested, on demand to reflect the virtual machine's internal state.
  • FIG. 1 is an overview block diagram of how a browsable JavaTM virtual machine operates with a web browser in accordance with one embodiment of the present invention.
  • a JavaTM virtual machine (JVM) 102 can be enabled through JVM command line options at start up to operate as a web server 104.
  • Web server 104 provides a window into the state and performance of JVM 102, described in greater detail in FIG. 2.
  • a user wanting to learn more about the state of JVM 102 can send a request 106 to JVM 102 via a web browser 108.
  • Web browser 108 is essentially location-independent as long as it has access to JVM 102 (security features are described below), performing as web server 104.
  • Web server 104 sends a reply or answer 110 back to web browser 108.
  • Processes for receiving the request and constructing a reply are described in FIGS. 3 A and 3B.
  • user request 106 is in HTTP formal and reply 110 is in the format of an HTTP response containing an HTML document.
  • FIG. 2 is a block diagram of JVM 102 enabled to function as web server 104 in accordance with one embodiment of the present invention.
  • JVM 102 functioning as web server 104.
  • One format of user request 106 is the HTTP format as shown in FIG. 2 in box 201.
  • Request 106 comes from web browser 108 pointing to JVM 102 over a secure or non-secure HTTP connection.
  • User request 106 is received by an HTTP daemon thread 202.
  • HTTP thread 202 exists when web server 104 is enabled, typically at JVM 102 start up.
  • HTTP thread 202 routes mcoming and outgoing traffic from web browser 108. It receives and processes HTTP requests made to web server 104 and routes replies back to the browser.
  • HTTP thread 202 and other components are introduced here in FIG. 2 and described in greater detail below.
  • HTTP thread 202 performs certain operations on user request 106 and a request data structure 204 is created.
  • Request data structure 204 contains a request segment 206 of user request 106, an empty reply buffer 208, and a pointer to a service 210 in a services library 212.
  • Services library 208 contains services available for handling requests from users.
  • a virtual machine (VM) thread 214 receives data structure 204 and constructs a reply or answer 216 to the request. More specifically, VM thread 214 sends reply buffer 218 storing an HTTP response containing an HTML document.
  • VM virtual machine
  • VM thread 214 is a worker in JMV 102 that handles virtual machine operations and starting up the virtual machine. Before VM thread 214 receives the request in the form of data structure 204, the request has been parsed and placed in condition for VM thread 214 to begin constructing a reply. VM thread 214 generates and writes HTML pages into HTTP response 218 that make up reply 216.
  • FIGS. 3 A and 3B are flow diagrams of a process for implementing a web server in a JavaTM virtual machine in accordance with one embodiment of the present invention.
  • a web server is invoked when the JVM is started and a web server flag is selected on the command line at JVM startup.
  • a port number to open a socket is selected, such as port 80, commonly used for web servers. For example, the following command can be used:
  • Java -XX:+EnableHttp -XX:InsecureHttpPort 8001 app
  • an HTTP thread is created and bound to the selected port. This thread traffics incoming HTTP requests to the JVM and outgoing replies.
  • an incoming HTTP request is received and parsed into substrings.
  • a browser connects with the VM to make a request, a two-way connection is established which is maintained until a reply can be constructed and returned, at which point the connection is closed.
  • the format of an HTTP request is specified in a set of specifications and drafts available from www.w3.org.
  • the HTTP request is decomposed (parsed) according to the HTTP/1.0 standard (also known as Informational RFC 1945). Once parsed, the service name is obtained by inspecting the Request-URI portion of the HTTP request and can be checked against a service library. If the service name or a particular version of a service is not found, a message is sent to the user.
  • the service such as heap
  • a services library by the HTTP thread.
  • Valid HTTP services are listed in the library, each listing accompanied by prefixes.
  • the types of services can vary on different JVMs and can be added to as needed.
  • a few examples are heap objects, profiling, memory usage, and thread stacks.
  • a memory usage service can be used to display heap usage statistics and can show heap profile by class. Data on each class can be displayed such as source file name, constant pool, methods, and fields.
  • Two internal options are heap profile for system classes and showing heap usage by generation.
  • a profiling service can be enabled/disabled at any time thereby limiting the performance impact to a time when the user actually wants to gather profile information.
  • a threads service allows a user to examine current running and waiting threads.
  • the HTTP thread creates a request data structure for the particular request.
  • one component of the data structure is a pointer to a service in the service library.
  • the pointer to the library service is also set.
  • the data structure also contains the request.
  • the incoming request will have a request which includes a particular service and specific parameters for that service.
  • the HTTP thread also creates a buffer in the data structure to hold the answer to the request in the form of an HTTP response containing an HTML document.
  • the format on an HTTP response is specified in a set of documents available' from www.w3.org.
  • the HTTP response is built in the form described in the HTTP/1.0 standard (also known as Informational RFC 1945).
  • the buffer can hold XML pages.
  • the HTTP thread passes the request data structure to the virtual machine (VM) thread using standard communication methods. More specifically, the data structure is placed in a VM queue from which the VM thread reads inputs. This allows the VM thread to process input in an orderly and consistent manner.
  • the VM thread services all types of requests (e.g., garbage collection, loading classes, etc.).
  • a single user HTTP request is processed at any given time. If a second HTTP request comes in, the HTTP thread is blocked on a VM queue lock until the first operation completes. Requests are not handled as interrupts; the HTTP thread has to ask for a new connection for the VM thread to process a new request.
  • the VM thread is placed at a safepoint when it receives a request data structure.
  • a safepoint is a well-known operation in the JVM which causes it to temporarily stop all operations. This is done to prevent the state of the VM from changing while the VM is being evaluated and to ensure that the JVM will act reliably. The extent and degree of this evaluation can vary greatly depending on the request. However, in these cases a safepoint operation is desirable. Some types of operations can be performed without triggering a safepoint.
  • the VM thread derives an answer or reply to the request.
  • the request data structure passed to the VM thread has been processed, or filtered, and placed in a condition in which it is unlikely that the VM thread will encounter any exceptions in the request. If at any point in the process an unrecognizable request or command is encountered, a standard NOT FOUND message is sent to the browser.
  • each incoming request go straight to VM thread and the VM thread decides how to handle the particular URL.
  • a traffic networking worker such as the HTTP thread may only be used to receive and transmit requests and replies, and nothing else.
  • the HTTP thread is used to also filter out bad requests, thereby reducing the risk that the VM thread will crash or be corrupted.
  • An answer to the request is derived using the particular library service pointed to in the request data structure.
  • the JVM uses this service in a standard way to gather whatever information it needs for the answer. For example, with a heap walking request for a particular class, the VM will walk through or explore its memory and determine how much memory is being used by a particular class.
  • the VM thread generates HTML directly into the reply buffer.
  • XML is generated into the reply buffer.
  • the JVM has generated a reply and sends it back to the HTTP thread in the form of HTML or XML pages.
  • the HTTP thread sends the answer to the browser that sent the request.
  • the HTTP thread sends the answer to the browser that sent the request.
  • the HTTP thread sends the answer to the browser that sent the request.
  • the HTTP thread sends the answer to the browser that sent the request.
  • the HTTP thread sends the answer to the browser that sent the request.
  • the HTTP thread sends the answer to the browser that sent the request.
  • the HTTP thread sends the answer to the browser
  • HTTP thread checks whether there is another HTTP request waiting to be received and processed. If there is, control returns to step 304 and the process is repeated. If not, the process ends.
  • the JVM can require that an incoming HTTP request be received over a secure HTTP connection, such as over a secure socket connection (e.g., SSL) using encryption, instead of a normal-text HTTP connection.
  • a secure HTTP connection such as over a secure socket connection (e.g., SSL) using encryption, instead of a normal-text HTTP connection.
  • SSL secure socket connection
  • This security can be important in situations where only certain users of the JVM can make certain types of requests into the state of the virtual machine.
  • Using standard secure socket connections allows the VM operator to regulate which users have access to the internal state of the VM. Such users may have access to files containing passwords, credit cards, social security numbers, or other sensitive data in the VM.
  • FIG. 4 is a diagrammatic representation of a virtual machine suitable for implementing the present invention.
  • source code 404 is provided to a compiler 406 within compile-time environment 405.
  • Compiler 406 translates source code 404 into bytecodes 408.
  • source code 404 is translated into bytecodes 408 at the time source code 404 is created by a software developer.
  • Bytecodes 408 may generally be reproduced, downloaded, or otherwise distributed through a network or stored on a storage device.
  • bytecodes 408 are platform independent. That is, bytecodes 408 may be executed on substantially any computer system that is running on a suitable virtual machine 412.
  • Bytecodes 408 are provided to a runtime environment 410 which includes virtual machine 412.
  • Runtime environment 410 may generally be executed using a processor or processors.
  • Virtual machine 412 includes a compiler 414, an interpreter 416, and a runtime system 418.
  • Bytecodes 408 may be provided either to compiler 414 or interpreter 416.
  • compiler 414 is a just-in-time compiler which delays the compilation of methods contained in bytecodes 408 until the methods are about to be executed.
  • interpreter 416 When bytecodes 408 are provided to interpreter 416, bytecodes 408 are read into interpreter 416 one bytecode at a time. Interpreter 416 then performs the operation defined by each bytecode as each bytecode is read into interpreter 416. That is, interpreter 416 "interprets" bytecodes 408, as will be appreciated by those skilled in the art. In general, interpreter 416 processes bytecodes 408 and performs operations associated with bytecodes 408 substantially continuously.
  • runtime system 418 may obtain the method from runtime environment 410 in the form of a sequence of bytecodes 408, which may be directly executed by interpreter 416. If, on the other hand, the method which is invoked is a compiled method which has not been compiled, runtime system 418 also obtains the method from runtime environment 410 in the form of a sequence of bytecodes 408, then may go on to activate compiler 414. Compiler 414 then generates machine instructions from bytecodes 408, and the resulting machine-language instructions may be executed directly by one or more processors. In general, the machine-language instructions are discarded when virtual machine 412 terminates.
  • the HTTP thread may not parse the incoming request but rather pass it on directly to the VM thread for processing by the VM thread, which can simplify the design of the web server configuration.
  • the services available for handling incoming requests can vary widely and be added to as needed. Accordingly, the present embodiments are to be considered as illustrative and not restrictive, and the invention is not to be limited to the details given herein, but may be modified within the scope and equivalents of the appended claims.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computer And Data Communications (AREA)
  • Debugging And Monitoring (AREA)
  • Devices For Executing Special Programs (AREA)
  • Information Transfer Between Computers (AREA)
  • Telephonic Communication Services (AREA)

Abstract

Apparatus, methods, and computer-readable media are disclosed for configuring a virtual machine, such as a Java™ virtual machine, to operate as a web server so that users, using a browser, can make general-purpose inquiries into the state of the virtual machine or, in some cases, mutate the state of the VM. A 'browsable' VM contains a network traffic worker, such as an HTTP thread, a services library, and a VM operations thread, which is an existing component in most virtual machines. The network traffic worker and the VM operations thread communicate through a request data structure. The VM operations thread generates a reply to the request upon receiving a request data structure from the traffic worker. Such a reply can be in the form of an HTTP response containing HTML or XML pages. These pages are transmitted back to the browser/user by the network traffic worker.

Description

A JAVA™ VIRTUAL MACHINE CONFIGURABLE TO PERFORM AS A
WEB SERVER
BACKGROUND OF THE INVENTION
1. FIELD OF THE INVENTION
The present invention relates generally to virtual machines. More specifically, it relates to enhancing a Java™ virtual machine for allowing inspection and modification of the state of the virtual machine through configuring the virtual machine to perform as a Web browser.
2. DISCUSSION OF RELATED ART
Over the last several years, the Java™ language and platform have become more widespread and their use is continually on the rise. An increasing number of applications are written in the Java™ language and are using a Java™ virtual machine. Java™ applications are being used increasingly in components, such as Web appliances, set-top boxes, and other types of computing devices. As the use of the Java™ virtual machine, needed to execute Java™ applications, increases, the demand for improving the development lifecycle of a Java™ application and improving the efficiency of a Java™ application becomes imperative. Getting a better understanding of the performance of the Java™ virtual machine is a step in this direction. However, as acknowledged in the field, Java™ virtual machines are seen as black boxes; opaque components that perform a crucial function but whose internal states are generally inaccessible to the users.
Presently, some tools are available that allow those working in particular areas, for example, Java™ application debugging, to get information on the state of a Java™ virtual machine pertaining specifically to the task of debugging an application. By using a debugging protocol, it is possible to ask the virtual machine questions about its state without interfering with its other operations. Another example is using profiling protocols to get specific information related to profile information. These tools or protocols typically require their own client and do not talk to a Java™ virtual machine using a Web browser.
One significant drawback of using these tools is that they are rigid and only provide a narrow band of information about the state of the virtual machine to the user. Furthermore, the information provided to the user, while specific to a particular purpose, is still rather high-level and gives the user a "bird's eye" view of the Java™ virtual machine state. Naturally, most users would prefer having more detailed, low-level information about the state and performance of the virtual machine if possible. In addition, users, whether VM developers, application developers, or enterprise users, would like to be able to make queries to the VM of a general nature, and not be limited to a specific task.
Therefore, it would be desirable to have a mechanism that allows interactively browsing the dynamic state of a Java™ virtual machine while it is executing an application or even while it is idle. Furthermore, it would be desirable to broaden the information returned to the user beyond a particular purpose or space. That is, allow the user to ask the virtual machine questions of a general nature yet get, as output, detailed, low-level state information in a convenient form. It would also be desirable to allow users to reliably query the state of the virtual machine using a widely available existing tool, without having to create a separate client host and with negligible interference to the virtual machine.
SUMMARY OF THE INVENTION
According to the present invention, virtual machines, methods, and computer- readable media are disclosed for configuring a virtual machine to operate as a web server so that users can inspect and/or modify the state of the virtual machine, such as a Java™ virtual machine using their browsers. In one aspect of the present invention, a virtual machine configurable to function as a web server is described. A browsable virtual machine has several components. One component is a request handler worker that handles incoming queries relating generally to the virtual machine. In one embodiment, the request handler worker is an HTTP thread and the incoming request is in HTTP format. The virtual machine has a library of services which can be used to construct responses to the requests. A service is used to perform specific operations in the virtual machine to respond to the incoming query. Another component is an operations worker for constructing output containing a reply to the incoming query. The reply typically provides insight into or mutates the operation of the virtual machine. In another aspect of the present invention, a method of handling an incoming query into the state of the virtual machine or a query to mutate the state of the virtual machine is described. Such a query will typically originate from a web browser. In the virtual machine, a network traffic worker for receiving and transmitting requests and responses, respectively, is invoked. This network traffic worker can be an HTTP thread for handling requests in HTTP format. Once the request is received by the network traffic manager, the request is processed to determine the service called for in the request. The service can be invoked by accessing a service library. The network traffic manager creates a request data structure. The request data structure is passed to a virtual machine operations worker which is responsible for constructing a response to the request. The response may be passive information on the state of the virtual machine (e.g., memory allocations) or the response may be a mutation of the state of the virtual machine. The response is then transmitted to the browser or user. This can be done by the network traffic manager.
BRIEF DESCRIPTION OF THE DRAWINGS
The invention will be better understood by reference to the following description taken in conjunction with the accompanying drawings in which:
FIG. 1 is an overview block diagram of how a browsable virtual machine operates in accordance with one embodiment of the present invention.
FIG. 2 is a block diagram of a Java™ virtual machine enabled to function as a web server in accordance with one embodiment of the present invention.
FIGS. 3 A and 3B are flow diagrams of a process of implementing a web server in a Java™ virtual machine in accordance with one embodiment of the present invention. FIG. 4 is a diagrammatic representation of a virtual machine suitable for implementing the present invention.
PET AIT, n DESCRIPTION
Reference will now be made in detail to a preferred embodiment of the invention. An example of the preferred embodiment is illustrated in the accompanying drawings. While the invention will be described in conjunction with a preferred embodiment, it will be understood that it is not intended to limit the invention to one preferred embodiment. To the contrary, it is intended to cover alternatives, modifications, and equivalents as may be included within the spirit and scope of the invention as defined by the appended claims.
As more software engineers work with the Java™ programming language to create Java™ applications, there will be an increasing desire to have a better understanding of how their Java™ applications perform through real-time observation of their programs executing. The application development lifecycle is made more efficient if users can study executing applications with ease, which is presently difficult to do with generally opaque Java™ virtual machines. In accordance with one embodiment of the present invention, there is provided a
Java™ virtual machine that can perform as a web server as described in the various figures. This web server, when enabled in a Java™ virtual machine, provides transparent access, or a small window, to the state of the JVM. This "browsable VM" allows end-users to gather insights about their application and the application's runtime characteristics. The user can glean insights, for example, about where the application is spending its time during steady-state runtime (ignoring startup and shutdown overhead) in order to improve performance, as well as identifying potential memory inefficiencies. Generally, information most useful to application and VM developers is either application monitoring information or information related to a JVM internal problem. The JVM generates HTML pages, containing the information requested, on demand to reflect the virtual machine's internal state. This allows a user to observe all Java™ threads, all Java™ objects, and the time spent by the JVM in individual Java™ methods (profiling), all in real time. It can also enable remote diagnostics, remote debugging, and remote configuration and control of the JVM.
To further illustrate the foregoing, FIG. 1 is an overview block diagram of how a browsable Java™ virtual machine operates with a web browser in accordance with one embodiment of the present invention. A Java™ virtual machine (JVM) 102 can be enabled through JVM command line options at start up to operate as a web server 104. Web server 104 provides a window into the state and performance of JVM 102, described in greater detail in FIG. 2. A user wanting to learn more about the state of JVM 102 can send a request 106 to JVM 102 via a web browser 108. Web browser 108 is essentially location-independent as long as it has access to JVM 102 (security features are described below), performing as web server 104. Web server 104 sends a reply or answer 110 back to web browser 108. Processes for receiving the request and constructing a reply are described in FIGS. 3 A and 3B. In the described embodiment, user request 106 is in HTTP formal and reply 110 is in the format of an HTTP response containing an HTML document.
FIG. 2 is a block diagram of JVM 102 enabled to function as web server 104 in accordance with one embodiment of the present invention. A more generic description of JVM 102 is provided in FIG. 4. User request 106 is received by JVM 102 functioning as web server 104. One format of user request 106 is the HTTP format as shown in FIG. 2 in box 201. Request 106 comes from web browser 108 pointing to JVM 102 over a secure or non-secure HTTP connection. User request 106 is received by an HTTP daemon thread 202. HTTP thread 202 exists when web server 104 is enabled, typically at JVM 102 start up. HTTP thread 202 routes mcoming and outgoing traffic from web browser 108. It receives and processes HTTP requests made to web server 104 and routes replies back to the browser. HTTP thread 202 and other components are introduced here in FIG. 2 and described in greater detail below.
HTTP thread 202 performs certain operations on user request 106 and a request data structure 204 is created. Request data structure 204 contains a request segment 206 of user request 106, an empty reply buffer 208, and a pointer to a service 210 in a services library 212. Services library 208 contains services available for handling requests from users. A virtual machine (VM) thread 214 receives data structure 204 and constructs a reply or answer 216 to the request. More specifically, VM thread 214 sends reply buffer 218 storing an HTTP response containing an HTML document.
As is known in the field, VM thread 214 is a worker in JMV 102 that handles virtual machine operations and starting up the virtual machine. Before VM thread 214 receives the request in the form of data structure 204, the request has been parsed and placed in condition for VM thread 214 to begin constructing a reply. VM thread 214 generates and writes HTML pages into HTTP response 218 that make up reply 216.
These pages are inserted in reply buffer 208, now buffer 218 holding HTTP response and sent back to HTTP thread 202. Thread 202 then send a reply 216 back to the web browser. In other preferred embodiments, workers can be implemented using other constructs instead of threads. FIGS. 3 A and 3B are flow diagrams of a process for implementing a web server in a Java™ virtual machine in accordance with one embodiment of the present invention. At step 302 a web server is invoked when the JVM is started and a web server flag is selected on the command line at JVM startup. In addition, a port number to open a socket is selected, such as port 80, commonly used for web servers. For example, the following command can be used:
Java -XX:+EnableHttp -XX:InsecureHttpPort=8001 app By selecting the web server option at startup, an HTTP thread is created and bound to the selected port. This thread traffics incoming HTTP requests to the JVM and outgoing replies. At step 304 an incoming HTTP request is received and parsed into substrings. When a browser connects with the VM to make a request, a two-way connection is established which is maintained until a reply can be constructed and returned, at which point the connection is closed. The format of an HTTP request is specified in a set of specifications and drafts available from www.w3.org. In one embodiment of the present invention, the HTTP request is decomposed (parsed) according to the HTTP/1.0 standard (also known as Informational RFC 1945). Once parsed, the service name is obtained by inspecting the Request-URI portion of the HTTP request and can be checked against a service library. If the service name or a particular version of a service is not found, a message is sent to the user.
Once the incoming request is parsed, at step 306 the service, such as heap, is retrieved from a services library by the HTTP thread. Valid HTTP services are listed in the library, each listing accompanied by prefixes. The types of services can vary on different JVMs and can be added to as needed. A few examples are heap objects, profiling, memory usage, and thread stacks. A memory usage service can be used to display heap usage statistics and can show heap profile by class. Data on each class can be displayed such as source file name, constant pool, methods, and fields. Two internal options are heap profile for system classes and showing heap usage by generation. A profiling service can be enabled/disabled at any time thereby limiting the performance impact to a time when the user actually wants to gather profile information. It allows a user to gather profiling data around specific end-user actions, or only during a steady state or when there is a slowdown. Several options are available such as showing a full profile, profiles of individual threads, or a "flat" profile. A threads service allows a user to examine current running and waiting threads. At step 308 the HTTP thread creates a request data structure for the particular request. As noted above, one component of the data structure is a pointer to a service in the service library. At step 306 the pointer to the library service is also set. The data structure also contains the request. Thus, the incoming request will have a request which includes a particular service and specific parameters for that service. The HTTP thread also creates a buffer in the data structure to hold the answer to the request in the form of an HTTP response containing an HTML document. The format on an HTTP response is specified in a set of documents available' from www.w3.org. In one embodiment of the present invention, the HTTP response is built in the form described in the HTTP/1.0 standard (also known as Informational RFC 1945). In other preferred embodiments, the buffer can hold XML pages.
At step 310 the HTTP thread passes the request data structure to the virtual machine (VM) thread using standard communication methods. More specifically, the data structure is placed in a VM queue from which the VM thread reads inputs. This allows the VM thread to process input in an orderly and consistent manner. The VM thread services all types of requests (e.g., garbage collection, loading classes, etc.). In the described embodiment, a single user HTTP request is processed at any given time. If a second HTTP request comes in, the HTTP thread is blocked on a VM queue lock until the first operation completes. Requests are not handled as interrupts; the HTTP thread has to ask for a new connection for the VM thread to process a new request. In the described embodiment, the VM thread is placed at a safepoint when it receives a request data structure.
Once the VM thread receives the request data structure, it triggers a safepoint at step 312 of FIG. 3B. A safepoint is a well-known operation in the JVM which causes it to temporarily stop all operations. This is done to prevent the state of the VM from changing while the VM is being evaluated and to ensure that the JVM will act reliably. The extent and degree of this evaluation can vary greatly depending on the request. However, in these cases a safepoint operation is desirable. Some types of operations can be performed without triggering a safepoint. At step 314 the VM thread derives an answer or reply to the request. In the described embodiment, the request data structure passed to the VM thread has been processed, or filtered, and placed in a condition in which it is unlikely that the VM thread will encounter any exceptions in the request. If at any point in the process an unrecognizable request or command is encountered, a standard NOT FOUND message is sent to the browser.
In other preferred embodiments, it is possible that each incoming request go straight to VM thread and the VM thread decides how to handle the particular URL. A traffic networking worker, such as the HTTP thread may only be used to receive and transmit requests and replies, and nothing else. However, in the described embodiment, the HTTP thread is used to also filter out bad requests, thereby reducing the risk that the VM thread will crash or be corrupted.
An answer to the request is derived using the particular library service pointed to in the request data structure. The JVM uses this service in a standard way to gather whatever information it needs for the answer. For example, with a heap walking request for a particular class, the VM will walk through or explore its memory and determine how much memory is being used by a particular class. Thus, at step 314 the VM thread generates HTML directly into the reply buffer. In other preferred embodiments, XML is generated into the reply buffer. As is known in the field, there are header fields that need to be filled in for an HTML page. All this can be done with very low overhead and memory usage by the VM. Most of the processing done to derive an answer is done by performing the appropriate service. At step 316 the JVM has generated a reply and sends it back to the HTTP thread in the form of HTML or XML pages. At step 318, the HTTP thread sends the answer to the browser that sent the request. At step 320 the
HTTP thread checks whether there is another HTTP request waiting to be received and processed. If there is, control returns to step 304 and the process is repeated. If not, the process ends.
The JVM can require that an incoming HTTP request be received over a secure HTTP connection, such as over a secure socket connection (e.g., SSL) using encryption, instead of a normal-text HTTP connection. This security can be important in situations where only certain users of the JVM can make certain types of requests into the state of the virtual machine. Using standard secure socket connections allows the VM operator to regulate which users have access to the internal state of the VM. Such users may have access to files containing passwords, credit cards, social security numbers, or other sensitive data in the VM.
FIG. 4 is a diagrammatic representation of a virtual machine suitable for implementing the present invention. When a computer program, e.g., a computer program written in the Java™ programming language, is executed, source code 404 is provided to a compiler 406 within compile-time environment 405. Compiler 406 translates source code 404 into bytecodes 408. In general, source code 404 is translated into bytecodes 408 at the time source code 404 is created by a software developer. Bytecodes 408 may generally be reproduced, downloaded, or otherwise distributed through a network or stored on a storage device. In the described embodiment, bytecodes 408 are platform independent. That is, bytecodes 408 may be executed on substantially any computer system that is running on a suitable virtual machine 412. Bytecodes 408 are provided to a runtime environment 410 which includes virtual machine 412. Runtime environment 410 may generally be executed using a processor or processors. Virtual machine 412 includes a compiler 414, an interpreter 416, and a runtime system 418. Bytecodes 408 may be provided either to compiler 414 or interpreter 416. When bytecodes 408 are provided to compiler 414, methods contained in bytecodes 408 are compiled into machine instructions. In one embodiment, compiler 414 is a just-in-time compiler which delays the compilation of methods contained in bytecodes 408 until the methods are about to be executed. When bytecodes 408 are provided to interpreter 416, bytecodes 408 are read into interpreter 416 one bytecode at a time. Interpreter 416 then performs the operation defined by each bytecode as each bytecode is read into interpreter 416. That is, interpreter 416 "interprets" bytecodes 408, as will be appreciated by those skilled in the art. In general, interpreter 416 processes bytecodes 408 and performs operations associated with bytecodes 408 substantially continuously. When a method is invoked by another method, or is invoked from runtime environment 410, if the method is interpreted, runtime system 418 may obtain the method from runtime environment 410 in the form of a sequence of bytecodes 408, which may be directly executed by interpreter 416. If, on the other hand, the method which is invoked is a compiled method which has not been compiled, runtime system 418 also obtains the method from runtime environment 410 in the form of a sequence of bytecodes 408, then may go on to activate compiler 414. Compiler 414 then generates machine instructions from bytecodes 408, and the resulting machine-language instructions may be executed directly by one or more processors. In general, the machine-language instructions are discarded when virtual machine 412 terminates. The operation of virtual machines or, more particularly, Java™ virtual machines, is described in more detail in The Java™ Virtual Machine Specification by Tim Lindholm and Frank Yellin (ISBN 0-201-63452-X), which is incorporated herein by reference. Although the foregoing invention has been described in some detail for purposes of clarity of understanding, it will be apparent that certain changes and modifications may be practiced within the scope of the appended claims. Furthermore, it should be noted that there are alternative ways of implementing both the process and apparatus of the present invention. For example, the reply sent to the user may be in the form of XML pages, or other appropriate markup language, and need not be HTML pages. In another example, the HTTP thread may not parse the incoming request but rather pass it on directly to the VM thread for processing by the VM thread, which can simplify the design of the web server configuration. In addition, the services available for handling incoming requests can vary widely and be added to as needed. Accordingly, the present embodiments are to be considered as illustrative and not restrictive, and the invention is not to be limited to the details given herein, but may be modified within the scope and equivalents of the appended claims.

Claims

CLAIMSWhat is claimed is:
1. A virtual machine configurable to function as a web server, the virtual machine comprising: a request handler worker for handling queries relating to the virtual machine; a plurality of services wherein a service performs operations for replying to an incoming query; and an operations worker for constructing output containing a reply to the incoming query, wherein the reply provides insight into or effects the operation of the virtual machine.
2. A virtual machine as recited in claim 1 wherein the request handler worker is an HTTP thread.
3. A virtual machine as recited in any of claims 1 -2 wherein the incoming query is in HTTP format.
4. A virtual machine as recited in any of claims 1 -3 wherein the request handler worker further includes a query parser for parsing the incoming query.
5. A virtual machine as recited in any of claims 1-4 wherein the request handler worker is created upon starting up the virtual machine.
6. A virtual machine as recited in any of claims 1-5 wherein the request handler worker functions as a network traffic manager for routing queries and responses.
7. A virtual machine as recited in any of claims 1 -6 wherein the plurality of services contains an index of available services and parameters for each service.
8. A virtual machine as recited in any of claims 1 -7 wherein the operation worker is a virtual machine operations thread.
9. A virtual machine as recited in any of claims 1-8 further including a request data structure for transferring data between the request handler worker and the operations worker.
10. A virtual machine as recited in claim 9 wherein the request handler worker creates the request data structure.
11. A virtual machine as recited in claim 9 wherein the request data structure has a service pointer area, a response buffer area, and a segment query area.
12. A virtual machine as recited in any of claims 1-11 wherein the virtual machine is a Java™ virtual machine.
13. A method of handling an incoming query to a virtual machine comprising: invoking a network traffic worker for receiving the request; receiving a request from a browser; processing the request to determine the service needed to respond to the request; creating a request data structure; effecting a response to the request by passing the request data structure to a virtual machine operations worker; and transmitting the response to the browser.
14. A method as recited in claim 13 further including invoking a web server in the virtual machine.
15. A method as recited in any of claims 13-14 further including creating a request thread.
16. A method as recited in any of claims 13-15 wherein receiving a request from a browser further includes establishing a secure HTTP connection where the request is an HTTP request.
17. A method as recited in any of claims 13-16 wherein processing the request further includes parsing the request into segments thereby determining the service needed to respond to the request.
18. A method as recited in any of claims 13-17 further including creating a pointer to the service in a service library.
19. A method as recited in any of claims 13-18 wherein creating a request data structure further includes: creating a first storage area for holding a pointer to an appropriate service; creating a second storage area for holding a segment of the request; and creating a third storage area for holding a response to the request.
20. A method as recited in any of claims 13-19 further including generating an HTTP response containing an HTML document into the third storage area of the request data structure.
21. A method as recited in any of claims 13-19 further including generating XML pages into the third storage area of the request data structure.
22. A method as recited in any of claims 13-21 further including performing operations in the virtual machine using the service and under the control of the virtual machine operations worker.
23. A method as recited in any of claims 13-22 further including stopping normal operation of the virtual machine while the request is acted upon.
24. A method as recited in any of claims 13-23 further including sending a response from the virtual machine operations worker to the network traffic worker.
25. A method as recited in any of claims 13-24 wherein transmitting the response to the browser further includes the network traffic manager sending the response to the browser.
26. A computer-readable medium containing programmed instructions arranged to handle an incoming query to a virtual machine, the computer-readable medium including programmed instructions for: invoking a network traffic worker for receiving the request; receiving a request from a browser; processing the request to determine the service needed to respond to the request; creating a request data structure; effecting a response to the request by passing the request data structure to a virtual machine operations worker; and transmitting the response to the browser.
PCT/US2001/015946 2000-06-02 2001-05-15 A javatm virtual machine configurable to perform as a web server WO2001095153A2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
AU2001263220A AU2001263220A1 (en) 2000-06-02 2001-05-15 A javatm virtual machine configurable to perform as a web server
EP01937489.1A EP1364309B1 (en) 2000-06-02 2001-05-15 A java virtual machine configurable to perform as a web server

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US09/585,945 2000-06-02
US09/585,945 US7039691B1 (en) 2000-06-02 2000-06-02 Java virtual machine configurable to perform as a web server

Publications (2)

Publication Number Publication Date
WO2001095153A2 true WO2001095153A2 (en) 2001-12-13
WO2001095153A3 WO2001095153A3 (en) 2003-09-04

Family

ID=24343643

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/US2001/015946 WO2001095153A2 (en) 2000-06-02 2001-05-15 A javatm virtual machine configurable to perform as a web server

Country Status (4)

Country Link
US (1) US7039691B1 (en)
EP (1) EP1364309B1 (en)
AU (1) AU2001263220A1 (en)
WO (1) WO2001095153A2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2414148A (en) * 2004-05-07 2005-11-16 Zeus Technology Ltd Managing the flow of data traffic
EP1869827A1 (en) * 2005-02-22 2007-12-26 Nextair Corporation Determining operational status of a mobile device capable of executing server-side applications

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7853960B1 (en) * 2005-02-25 2010-12-14 Vmware, Inc. Efficient virtualization of input/output completions for a virtual device
US8024790B2 (en) * 2007-04-11 2011-09-20 Trend Micro Incorporated Portable secured computing environment for performing online confidential transactions in untrusted computers
US8201246B1 (en) 2008-02-25 2012-06-12 Trend Micro Incorporated Preventing malicious codes from performing malicious actions in a computer system
US8595702B2 (en) * 2009-03-13 2013-11-26 Microsoft Corporation Simultaneously displaying multiple call stacks in an interactive debugger
US20110125994A1 (en) * 2009-11-05 2011-05-26 TAP Innovations, Inc. Methods and systems for secure online browsing
US8479294B1 (en) 2011-02-15 2013-07-02 Trend Micro Incorporated Anti-malware scan management in high-availability virtualization environments
US8484732B1 (en) 2012-02-01 2013-07-09 Trend Micro Incorporated Protecting computers against virtual machine exploits
US8966632B1 (en) 2012-02-17 2015-02-24 Trend Micro Incorporated In-the-cloud sandbox for inspecting mobile applications for malicious content
US9300720B1 (en) 2013-05-21 2016-03-29 Trend Micro Incorporated Systems and methods for providing user inputs to remote mobile operating systems
US9225799B1 (en) 2013-05-21 2015-12-29 Trend Micro Incorporated Client-side rendering for virtual mobile infrastructure
US9444912B1 (en) 2013-05-21 2016-09-13 Trend Micro Incorporated Virtual mobile infrastructure for mobile devices
US9049169B1 (en) 2013-05-30 2015-06-02 Trend Micro Incorporated Mobile email protection for private computer networks
US9507617B1 (en) 2013-12-02 2016-11-29 Trend Micro Incorporated Inter-virtual machine communication using pseudo devices
US10785288B2 (en) * 2017-02-22 2020-09-22 International Business Machines Corporation Deferential support of request driven cloud services

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6185619B1 (en) * 1996-12-09 2001-02-06 Genuity Inc. Method and apparatus for balancing the process load on network servers according to network and serve based policies
CA2401715C (en) * 1997-06-25 2009-10-06 Richard James Humpleman Browser based command and control home network
CA2307297C (en) 1997-10-29 2009-07-21 Geodesic Systems, Incorporated Interactive debugging system with debug data base system
US6044398A (en) * 1997-11-21 2000-03-28 International Business Machines Corporation Virtual dynamic browsing system and method for automated web server and testing
US6182142B1 (en) * 1998-07-10 2001-01-30 Encommerce, Inc. Distributed access management of information resources
US6433794B1 (en) * 1998-07-31 2002-08-13 International Business Machines Corporation Method and apparatus for selecting a java virtual machine for use with a browser
US6295643B1 (en) * 1998-12-10 2001-09-25 International Business Machines Corporation Method and apparatus for improving java virtual machine performance using persistent execution information
US6788980B1 (en) * 1999-06-11 2004-09-07 Invensys Systems, Inc. Methods and apparatus for control using control devices that provide a virtual machine environment and that communicate via an IP network
US6327609B1 (en) * 1999-09-22 2001-12-04 Audiobase, Inc. System and method for using cookies in java

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"IBM Technical Disclosure Bulletin", vol. 38/12, December 1995, pages: 479
CHINTALPATI: "Web Server And Browser Design Considerations", ANNUAL REVIEW OF COMMUNICATIONS, NATIONAL ENGINEERING CONSORTIUM, CHICAGO, vol. 50, 1997, pages 639 - 656
LOWE: "HQw Java Servlets Can Replace CGI Scripts - For Ease, Performance & More", NETSCAPEWORLD, May 1997 (1997-05-01)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2414148A (en) * 2004-05-07 2005-11-16 Zeus Technology Ltd Managing the flow of data traffic
EP1869827A1 (en) * 2005-02-22 2007-12-26 Nextair Corporation Determining operational status of a mobile device capable of executing server-side applications
EP1869827B1 (en) * 2005-02-22 2019-01-09 BlackBerry Limited Determining operational status of a mobile device capable of executing server-side applications

Also Published As

Publication number Publication date
EP1364309B1 (en) 2018-12-05
EP1364309A2 (en) 2003-11-26
US7039691B1 (en) 2006-05-02
WO2001095153A3 (en) 2003-09-04
AU2001263220A1 (en) 2001-12-17

Similar Documents

Publication Publication Date Title
US7039691B1 (en) Java virtual machine configurable to perform as a web server
Tonella Using a concept lattice of decomposition slices for program understanding and impact analysis
Lam et al. A general dynamic information flow tracking framework for security applications
Thorn Programming languages for mobile code
US6295643B1 (en) Method and apparatus for improving java virtual machine performance using persistent execution information
US9021448B1 (en) Automated pattern detection in software for optimal instrumentation
US6253370B1 (en) Method and apparatus for annotating a computer program to facilitate subsequent processing of the program
JP5367379B2 (en) Binary code analysis
US20130152064A1 (en) Classloader/Instrumentation Approach For Invoking Non-Bound Libraries
Sansom Execution profiling for non-strict functional languages
Greenwood et al. A framework for policy driven auto-adaptive systems using dynamic framed aspects
Schear et al. High-speed matching of vulnerability signatures
JP3888818B2 (en) Method for performing I / O operation in information processing apparatus, computer readable medium including program instructions therefor, and information processing system for executing I / O
Pase Dynamic probe class library (dpcl): Tutorial and reference guide
Luján et al. Elimination of Java array bounds checks in the presence of indirection
Chothia et al. A distributed π-calculus with local areas of communication
Garcia-Contreras et al. Fast Approximations of Quantifier Elimination
Cervesato et al. A comparison between strand spaces and multiset rewriting for security protocol analysis
De Nicola et al. Confining data and processes in global computing applications
Eluard et al. Secure object flow analysis for java card
Harrison et al. CAT: A toolkit for assembling concerns
Baaij et al. Soosim: Operating system and programming language exploration
US20230136524A1 (en) Dynamic instrumentation to capture cleartext from transformed communications
Kern et al. Class splitting as a method to reduce migration overhead of mobile agents
Srivastava Practical Methods for Fuzzing Real-World Systems

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A2

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BY BZ CA CH CN CR CU CZ DE DK DM DZ EE ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NO NZ PL PT RO RU SD SE SG SI SK SL TJ TM TR TT TZ UA UG UZ VN YU ZA ZW

AL Designated countries for regional patents

Kind code of ref document: A2

Designated state(s): GH GM KE LS MW MZ SD SL SZ TZ UG ZW AM AZ BY KG KZ MD RU TJ TM AT BE CH CY DE DK ES FI FR GB GR IE IT LU MC NL PT SE TR BF BJ CF CG CI CM GA GN GW ML MR NE SN TD TG

121 Ep: the epo has been informed by wipo that ep was designated in this application
DFPE Request for preliminary examination filed prior to expiration of 19th month from priority date (pct application filed before 20040101)
WWE Wipo information: entry into national phase

Ref document number: 2001937489

Country of ref document: EP

WWP Wipo information: published in national office

Ref document number: 2001937489

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: JP