Computers generally have a number of system properties that may be accessed and used by applications. Examples of such system properties include time and date, geographic location, language, and the like. There may be situations when a software developer or administrator has a need to use a different time than that maintained by the system. For example, a developer may want to test a program by simulating a time other than the current time. In another example, after a system has failed, an administrator may want to perform an operation as if it occurred during a time in the past.
One way to achieve these needs is to directly modify the system properties. For example, a developer or administrator can modify the system time to a time in the past, execute a program or perform an operation, and reset the system time to the current time. However, such a solution may be incomplete or may result in undesired side effects. For example, other applications, users, or operations, or the system itself, may be subject to the modified system time.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Briefly, in one embodiment, a system, method, and components operate to modify a system property corresponding to a request for a service. Mechanisms may include receiving a service request, the request including a property adjustment, creating and storing the property adjustment in an apartment corresponding to the service request and, in response to a request for an adjusted system property corresponding to the service request, retrieving the property adjustment and determining an adjusted system property corresponding to the request based on the system property and the property adjustment.
In one embodiment, the system property is system time and the adjusted system property is a time offset specification.
In one embodiment, the request is sent from a first computing device to a second computing device. The time offset specification may be passed in a request message.
In one embodiment, the apartment is stored in a logical call context corresponding to the service request, enabling two or more threads that perform operations corresponding to the request for service to retrieve the apartment.
In one aspect of the mechanisms described herein, multiple service requests may be received, each request having a corresponding time offset. Each time offset may be stored in a corresponding apartment, enabling program code operating on each request to retrieve the corresponding time offset and determine a corresponding adjusted time.
The mechanisms described may be used to simulate performing operations at a time different from the system time, enabling testing or failure recovery without disturbing the system time or processes performing other operations.
To the accomplishment of the foregoing and related ends, certain illustrative aspects of the system are described herein in connection with the following description and the annexed drawings. These aspects are indicative, however, of but a few of the various ways in which the principles of the invention may be employed and the present invention is intended to include all such aspects and their equivalents. Other advantages and novel features of the invention may become apparent from the following detailed description of the invention when considered in conjunction with the drawings.
Non-limiting and non-exhaustive embodiments of the present invention are described with reference to the following drawings. In the drawings, like reference numerals refer to like parts throughout the various figures unless otherwise specified.
To assist in understanding the present invention, reference will be made to the following Detailed Description, which is to be read in association with the accompanying drawings, wherein:
Example embodiments of the present invention now will be described more fully hereinafter with reference to the accompanying drawings, which form a part hereof, and which show, by way of illustration, specific example embodiments by which the invention may be practiced. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art. Among other things, the present invention may be embodied as methods or devices. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. The following detailed description is, therefore, not to be taken in a limiting sense.
Throughout the specification and claims, the following terms take the meanings explicitly associated herein, unless the context clearly dictates otherwise. The phrase “in one embodiment” as used herein does not necessarily refer to a previous embodiment, though it may. Furthermore, the phrase “in another embodiment” as used herein does not necessarily refer to a different embodiment, although it may. Thus, various embodiments of the invention may be readily combined, without departing from the scope or spirit of the invention. Similarly, the phrase “in one implementation” as used herein does not necessarily refer to the same implementation, though it may, and techniques of various implementations may be combined.
In addition, as used herein, the term “or” is an inclusive “or” operator, and is equivalent to the term “and/or,” unless the context clearly dictates otherwise. The term “based on” is not exclusive and allows for being based on additional factors not described, unless the context clearly dictates otherwise. In addition, throughout the specification, the meaning of “a,” “an,” and “the” include plural references. The meaning of “in” includes “in” and “on.”
As used herein, the term “processor” refers to a physical component such as an integrated circuit that may include integrated logic to perform actions.
As used herein, the term “thread” refers to a thread of execution. A thread may be a software thread or a hardware thread. In a hardware multi-threaded processor, two or more threads may concurrently exist on the processor. Some processors provide multiple sets of registers or other components, so that multiple hardware threads may each have their own set of registers. A hardware multi-threaded processor may have a number of software threads that is greater than the number of hardware threads it supports. An operating system may manage the software threads, providing each a turn at executing as a hardware thread.
As used herein, a multi-threaded system is a system that supports multiple threads, which may be software or hardware threads. A multi-threaded system may or may not have hardware support for multi-threading.
As used herein, the term “pointer” refers to a reference to a target physical or logical memory location, data structure, program instruction, or program segment. A pointer “points to” a target and may be used to locate or obtain the target. A pointer may be implemented in a variety of ways, including an address, an offset, an index, or an identifier.
As used herein, the term “time” refers to data that specifies a date, a time of day, or a combination thereof. Time may be represented in a variety of ways, such as a number of seconds after a designated base time, a year/day/minute specification, or in another manner. The term “system time” refers to a setting of a system clock that indicates a time of the computer system. Typically, each computing device has its own system clock that keeps track of system time.
The components described herein may execute from various computer-readable media having various data structures thereon. The components may communicate via local or remote processes such as in accordance with a signal having one or more data packets (e.g. data from one component interacting with another component in a local system, distributed system, or across a network such as the Internet with other systems via the signal). Software components may be stored, for example, on non-transitory computer-readable storage media including, but not limited to, an application specific integrated circuit (ASIC), compact disk (CD), digital versatile disk (DVD), random access memory (RAM), read only memory (ROM), floppy disk, hard disk, electrically erasable programmable read only memory (EEPROM), flash memory, or a memory stick in accordance with embodiments of the present invention.
The term computer-readable media as used herein includes both non-transitory storage media and communications media. Communications media typically embody computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism and include any information-delivery media. By way of example, and not limitation, communications media include wired media, such as wired networks and direct-wired connections, and wireless media such as acoustic, radio, infrared, and other wireless media.
As illustrated in
Each of client A 102 and client B 104 may communicate with Web service 106. Web service 106 may include one or more Web services or components thereof that operate in a coordinated manner to provide one or more services to each client. Examples of services include storing, retrieving, providing, or otherwise manipulating data, maintaining a subscription, payment systems, compute services, backup services, or other services. The multiple Web services 106 may be performed by one or more processors on a single device, on multiple respective devices, or distributed among multiple devices in a variety of configurations.
As illustrated in
A system employing mechanisms described herein may include one or more clients.
In the example system of
Though apartment A 116 and apartment B 120 are illustrated outside of Web service 106, in some implementations, each apartment may be stored within Web service 106, on a common device, or external to Web service 106 but accessed by the Web service.
In one embodiment, when Web service 106 performs operations relating to request 108, it uses data from apartment A 116, including time offset specification 118; when Web service 106 performs operations relating to request 112, it uses data from apartment B 120, including time offset specification 122.
In one embodiment, system 100, or portions thereof, run on the Windows Azure™ Platform, by Microsoft. Windows Azure™ includes an operating system that provides scalable compute and storage facilities, hosted in one or more data centers. This enables application providers to run their applications and services in a cloud environment, such as illustrated in
Communications between computing devices of system 100 may employ one or more of various wired or wireless communication protocols, such as IP, TCP/IP, UDP, HTTP, SSL, TLS, FTP, SMTP, WAP, Bluetooth, or WLAN.
Adjusted time 203 is a modification of the system time. It may be set by a person at the client device, or set automatically by program code configured to set the adjusted time corresponding to client 202. The adjusted time may be a time that is desired to be used by services performing operations related to a request by client 202. For example, if it is desired to simulate operations performed two days prior, adjusted time 203 may be set to be the date and time of two days prior to the present time.
As illustrated in
In one embodiment, outgoing message inspector 240 may perform the action of inserting time offset specification 220 into request 204. It may, for example, process a preliminary message created by client 202, retrieve adjusted time 203 from client 202, and determine a time offset specification based on the adjusted time 203 and the system time. It may then embed time offset specification 220 in request 204, or a transformation thereof. As discussed herein, in one implementation, the time offset specification may be embedded in a WCF header, a header of another protocol, or a message body.
In
As illustrated in the example of
In response to receiving request 204, Web service 208 may enter the request onto queue 218. In various implementations, this may be performed by sending a message, invoking a method, or other mechanism. Message 214 represents the various implementations of providing a request to be queued. Message 214 contains time offset specification 216, corresponding to request 204 and time offset specification 220 and apartment 210 with time offset specification 212. The data of message 214 may be considered to be a representation of apartment 210.
Each entry 219A-E of queue 218 may contain a representation of a corresponding apartment, as passed by a corresponding Web service request. As illustrated, queue entry 219A, containing time offset specification 224, may be considered to be an apartment corresponding to message 214 and apartment 210. Each other entry may have its own corresponding incoming message, apartment with a time offset specification, and request message.
The apartment of entry 219A may be implemented in a variety of ways, including a pointer to the actual data, or an ID that can be used to retrieve the data. Thus, the figure showing the data within the queue is to be considered a conceptual representation, and not necessarily a physical representation.
As illustrated in the example of
As discussed for message 214, retrieving a queue entry may be implemented in a variety of ways, including messages or method invocations, or passing a physical representation. Message 228, containing time offset specification 230, represents the various implementations. Data of message 228 may be considered to be another representation of apartment 210. As discussed for request 204, message 228 may include an apartment representation in its header.
In one implementation, in response to receiving queue entry 219E, worker process 232 may create apartment 236 containing time offset specification 238, corresponding to, and having the data of, message 228 and queue entry 219E. Though message 228 and apartment 236 are illustrated as corresponding to queue entry 219E, when queue entry 219A is retrieved, the retrieval message and the resulting apartment will correspond to, and have the data of, request 204, message 214, and apartment 210.
Worker process 234 is another process that may perform operations related to a retrieved queue entry. In one configuration, worker process 234 and worker process 232 reside on a common computing device and share apartment 236. In one embodiment, each of worker process 234 and worker process 232 are threads; each may share thread logical data, and apartment 236 may be stored in a logical call context. A logical call context is a mechanism that may be used to store data and to pass it along to a series of execution components that perform operations corresponding to the request, though the series of execution components may include operations by one or more hardware or software threads. Each such thread may retrieve the apartment or time offset specification from the logical call context. At a subsequent time, a thread that performs operations corresponding to a first request may perform operations corresponding to a second request. While processing the second request, the thread may retrieve the apartment or time offset specification corresponding to the second request. Thus, apartments and time offset specifications correspond to a request, rather than to the threads that handle the request.
As illustrated by
In some embodiments, a system property other than time may be the property that is being adjusted by the mechanisms illustrated and described herein. Geographic region, language, domain name, email address, URL, or user name are examples of other system properties that may be adjusted. In some embodiments, the mechanisms described may be used to adjust application data, such as a logging threshold, a discount percentage, an email template, or other application data. When using a system property such as region, language, or domain name, the adjustment specification may be the ID of the adjusted property. For example, if the system property of language is “American English,” the adjustment specification may be “French.” Thus, time offset specifications 220, 212, 216, 224, 226, 230, 238, and other time offset specifications illustrated or discussed herein are examples of system property adjustments that may be used in various embodiments.
Web service 302 may be Web services 106, Web service 208, worker process 232, worker process 234, a component thereof, or another process with logic to retrieve time data.
As illustrated in
As illustrated, adjusted clock 312 may send a request 314 to system clock 320. In response, system clock 320 may return response 318 containing system time 316. After receiving system time 316, adjusted clock 312 may perform a calculation to determine an adjusted time based on the specified time offset 306 and system time 316. In some implementations, this may include converting the time offset specification units to match the system time, adding the time offset specification to the system time, or other calculations.
Adjusted clock 312 may then send response 310 back to Web service 302, the response containing adjusted time 308 as determined by adjusted clock 312.
The process may flow to block 404, where a request message to a Web service may be initiated. This may include, for example, a client component configuring data in the form of a message, initiating a send message command, or other actions.
The process may flow to block 406, where the adjusted time may be retrieved from the client. A time offset specification may be determined, based on the client adjusted time and the system time of the client. The time offset specification may be embedded in the request message, or a transformation thereof. Time offset specification 220, embedded within request 204 is an example of this. In one embodiment, a component such as outgoing message inspector 240 may perform at least a portion of the actions of block 406.
The process may flow to block 408, where the request message is sent to a Web service, such as Web service 208. The request message may be received by the Web service. In some configurations, additional components may act as intermediaries of the message sending, though the message is considered to be sent to the Web service, regardless.
The process may flow to block 410, where the time offset specification may be retrieved from the request message received by the Web service. At block 412, the retrieved time offset specification may be stored in an apartment corresponding to the request message. Apartment 210 is an example of such an apartment. Block 412 may include creating the apartment corresponding to the request message. In one embodiment, a component such as incoming message inspector 242 may perform actions of one or more of blocks 410, 412, or portions thereof. Incoming message inspector may receive the request message.
The process may flow to block 414, where the time offset may be used to process the request. The manner in which the time offset is used may vary, based on the business logic of the Web service handling the request. In one embodiment, the actions of block 414 may include retrieving the time offset from the apartment in which it is contained, determining an adjusted time setting, and using the adjusted time setting to perform operations related to the request. An example embodiment of such actions is illustrated in
The process may perform other actions, not shown, or exit.
Within loop 504, the process may flow to block 506, where a time offset may be retrieved from an apartment, such as apartment 210 of
The process may flow to block 508, where the retrieved time offset may be used to determine an adjusted time corresponding to the current request. An example embodiment of a process of determining an adjusted time is illustrated in
The process may flow to block 512. At block 512, upon completion of the iterations, loop 504 may exit. The process may flow to done block 514. The process may flow to other actions, not shown, exit or return to a calling program.
The process may flow to block 604, where a system time may be retrieved from a system clock. In one implementation, the actions of block 604 may include sending a request, such as request 314, to system clock 320, and receiving response 318 containing system time 316.
The process may flow to block 606, where an adjusted time may be determined, based on the system time and the time offset. The process may flow to block 608, where the determined adjusted time may be returned to the requester. As illustrated in
The mechanisms described herein may be used to test a computer system. For example, an adjusted time may be used to simulate operations performed at a time other than the current system time, in the future or in the past. A test may be performed without disturbing the system time on the computing devices, so that other operations that access the system time are not affected. In this way, tests may be performed in a system while the system is “live,” or multiple tests may be performed concurrently, each having a different adjusted system time.
The mechanisms may be used to perform recovery operations. For example, in a situation in which the system failed temporarily, an administrator may execute commands to perform the failed operations, simulating a time in the past when the original operations were to be performed. This may allow for proper construction or reconstruction of data. Such recovery may be performed without modifying the current system time. This allows the system to be used for “live” operations, to communicate correctly with other systems, for multiple concurrent recoveries, or for other reasons.
As illustrated, computing device 700 includes one or more processors 702, which perform actions to execute instructions of various computer programs. In one configuration, each processor 702 may include one or more central processing units, one or more processor cores, one or more ASICs, cache memory, or other hardware processing components and related program logic. Computing device 700 may be a multi-threaded system. As illustrated, computing device 700 includes an operating system 704. Operating system 704 may be a general purpose or special purpose operating system. The Windows® family of operating systems, by Microsoft Corporation, of Redmond, Wash., includes examples of operating systems that may execute on computing device 700. In one embodiment, operating system 704 may execute on a virtual machine. A virtual machine is a software implementation of a computing device that executes an operating system and programs. Each virtual machine may be isolated from other virtual machines on a common computing device. Windows Azure™ is one example of a platform that provides virtual machines.
In one embodiment, computing device 700 includes one or more graphics processing units (GPU) 716. A GPU is a processor that is configured to perform graphics operations, such as rendering a graphic image, or to perform stream processing.
Memory and storage 706 may include one or more of a variety of types of computer storage media, including volatile or non-volatile memory, RAM, ROM, solid-state memory, disk drives, optical storage, or any other medium that can be used to store digital information.
Memory and storage 706 may store one or more components described herein or other components. In one embodiment, memory and storage 706 stores Web service 106, queue 218, apartment A 116 and associated time offset specification 118, or apartment B 120 and associated time offset specification 122. In various embodiments, one or more of these components may be omitted from memory and storage 706. In some embodiments, at least a portion of one or more components may be implemented in a hardware component, such as an ASIC. In various configurations, multiple components implementing the functions or including the data of these components may be distributed among multiple computing devices. Communication among various distributed components may be performed over a variety of wired or wireless communications mechanisms.
Any one or more of the components illustrated as stored in memory and storage 706 may be moved to different locations in RAM, non-volatile memory, or between RAM and non-volatile memory by operating system 704 or other components. In some configurations, these components may be distributed among one or more computing devices, including computing devices that are remotely located from each other.
Computing device 700 may include a video display adapter 712 that facilitates display of data, scene frames, or other information to a user. Though not illustrated in
It will be understood that each block of the flowchart illustrations of
The above specification, examples, and data provide a complete description of the manufacture and use of the composition of the invention. Since many embodiments of the invention can be made without departing from the spirit and scope of the invention, the invention resides in the claims hereinafter appended.