Abstract:
High availability (HA) protection is provided for an executing virtual machine. At a checkpoint in the HA process, the active server suspends the virtual machine; and the active server copies dirty memory pages to a buffer. During the suspension of the virtual machine on the active host server, dirty memory pages are copied to a ring buffer. A copy process copies the dirty pages to a first location in the buffer. At a predetermined benchmark or threshold, a transmission process can begin. The transmission process can read data out of the buffer at a second location to send to the standby host. Both the copy and transmission processes can operate asynchronously on the ring buffer. The ring buffer cannot overflow because the transmission process continues to empty the ring buffer as the copy process continues. This arrangement allows for using smaller buffers and prevents buffer overflows, and thereby, it reduces the VM suspension time and improves the system efficiency.

Description:
CROSS REFERENCE TO RELATED APPLICATIONS 
     This Application claims priority to U.S. application Ser. No. 12/895,230, entitled “Method And Apparatus For Efficient Memory Replication For High Availability (HA) Protection of a Virtual Machine (VM),” filed on Sep. 30, 2010, and is related to U.S. patent application Ser. No. 12/711,968, entitled “Method and Apparatus for High Availability (HA) Protection of a Running Virtual Machine (VM),” to Chou et al., filed Feb. 24, 2010, these two Applications are incorporated by reference in their entirety for all that they teach and for all purposes. 
    
    
     BACKGROUND 
     Many computing systems are migrating to a “cloud computing” environment. Cloud computing is the use of a virtualized resource (referred to herein as a “virtual machine”) as a service over a network. The virtual machine can execute over a general technology infrastructure in the cloud. In other words, the virtual machine can operate on many different types of hardware computing systems or over several computing systems. The hardware computing systems are generally commodity type systems that are both inexpensive and easy to operate. Cloud computing often provides common business applications online that are accessed over the network, while the software and data are stored on servers. Cloud computing generally precludes the need to use specially designed hardware. 
     Unfortunately, the commodity type hardware can be prone to faults or breakdowns. As a result, the virtual machine may also be prone to faults from losing the underlying hardware platform. Some virtual machines execute applications that are required to be highly available. In other words, the applications cannot be prone to frequent faults. There have been attempts to create systems or processes to make virtual machines highly available. However, these prior approaches generally suffer from problems. 
     To copy data stored in memory used by the VM, the protected VM is generally suspended and copies of changed memories (dirty pages) are copied to a local memory buffer. Once the copying process is completed, the protected VM resumes running while the buffer starts transmitting the dirty pages in its local memory buffer to a standby host for system replication. Generally, the local memory buffer is pre-allocated with a fixed capacity in random access memory. 
     If the local memory buffer cannot hold all the dirty pages of the protected VM, prior systems generally send all the data in the local memory buffer to the standby host (empty/flush the buffer). Then, once the local memory buffer is empty again, the memory replication module copies the remaining dirty pages of the protected VM to the local memory buffer. This process is repeated until all dirty pages of the protected VM are copied to the buffer, and the protected VM resumes running once this copying process is completed. Thus, the VM is suspended at least through a complete copy process, the send process, and then the rest of the copy process. 
     This overflow of the buffer makes the memory replication very inefficient. The cost of handling a local memory buffer overflow is large because the protected VM has to be suspended and wait until the copy and flush process completes. Further, the memory copying process is also suspended until the local memory buffer empties the local memory buffer. The local memory buffer flushing process adds the additional network transmission overhead to the suspension time of the protected VM which can be large based on the network. In addition, the network transmission overhead is proportional to the size of the local memory buffer being used as that determines the amount of data to transmit before allowing the copying process to continue and before the protected VM is allowed to resume running. 
     In other systems, the local buffer is very large to ensure that the buffer is never overflowed. Unfortunately, the largest amount of dirty pages to copy for the protected VM often occur in peaks, and the amount of dirty pages can vary drastically beyond an order of magnitude depending on the running state of the protected VM. Thus, to protect against overflow, the buffer is made extremely large, which is also inefficient and costly. The large buffer can create a large memory footprint and take away a significant portion of the system resources. Further, the large buffer can incur a huge resource overhead and cannot extend to support multiple protected VMs. 
     The management of the read and write thread that moves data in and out of the buffer can be taxing on the processor and system. Generally, ring buffer requires frequent coordination between the read and write threads. The coordination ensures the two threads operate in sequence and are synchronized. However, establishing the coordination between the read and write threads can incur significant overhead on performance, as it requires signals to be sent between the controllers of the threads to wake up and stop the threads, and the said signals can become cumbersome as greater synchronicity requires more frequent signals and more stop-and-go action for read and write threads. 
     SUMMARY 
     It is with respect to the above issues and other problems that the embodiments presented herein were contemplated. The system includes an active host server and a standby host server that can execute a virtual machine. Upon the suspension of the virtual machine on the active host server, dirty memory pages are copied to a special ring buffer. A copy process copies the dirty pages to a first location in the buffer. The transmission process can read data out of the buffer at a second location to send to the standby host. Both the copy and transmission processes can operate simultaneously on the ring buffer. 
     In comparison to a traditional circular buffer, the special ring buffer described herein reduces the synchronization overhead and maximizes the throughput of the copying process of memory dirty pages, so that the VM suspension time can be minimized and efficiency of the protected system can be improved. The said buffer employs a lockless scheme to remove the synchronization when writing to or reading from the buffer, and the two processes pause only when the buffer is full or empty. In addition, this embodiments are based on the concept of treating the writing process and reading process with unequal priority, as explained below. First, the copy process has higher priority, and the copy process starts immediately and only pauses when the buffer is full. The transmission process has a lower priority, and the transmission process only starts when the available data in the ring buffer is over a predetermined benchmark or threshold. The transmission process is throttled so that the process reads an amount of data from the buffer during VM suspension, and reads continuously when the VM has resumed running. These arrangements significantly reduce the synchronization overhead as well as the suspension time, and thus allow for more efficient replication. 
     The embodiments introduce an efficient checkpoint algorithm to prevent buffer overflow and eliminate the extra VM suspension time. The embodiments make the data transmission phase independent of the status of the protected VM, whether the VM is suspended or running. The trigger of the data transmission phase depends only on the data availability in the local memory buffer. Once there is enough data in the local memory buffer, the sending task can be triggered. As a result, data transmission occurs during two different phases, while the VM is suspended and after VM resumed. By engaging the transmission process early, the embodiments eliminate the extra VM suspension time that occurs in prior art systems. 
     To achieve the goal mentioned above, instead of sequential processing of copying then empty the local memory buffer, the copying of dirty memory pages is separated into two separate parallel and coordinated threads, a copy thread and a send thread. The copy thread is responsible for copying dirty pages into the local memory buffer. On the other hand, the send thread reads dirty pages from the local memory buffer and transmits the memory pages to the standby host. The copy thread can be engaged immediately, as soon as the VM is suspended, and copies dirty pages to the local buffer as fast as possible. The functioning of the copy thread can guarantee the protected VM can be resumed without any delay once the dirtied memory pages are copied out. 
     A notification threshold may be employed to control when the send thread should engage. The copy thread may signal the send thread when the amount of data in the buffer is more than the notification threshold. In embodiments, the threshold may be defined as the amount of the buffer being used, e.g., 50% of the local memory buffer capacity. By setting this threshold, the embodiments achieve two goals: (1) there is at least 50% of remaining buffer capacity for the copy thread to continue copying (therefore, the copy thread will not be blocked); and (2) the send thread has enough data to send (50% of the buffer capacity) (the send thread will not be blocked waiting for data). 
     In alternative embodiments, the send thread may be rate controlled. The send thread can be restricted from reading all the available data in one attempt. If the send thread is too aggressive, the send thread can potentially flood the Transmission Control Protocol (TCP) channel, which can affect other applications. In addition, once the sender has no data to read, the send thread can sleep and wait for another notification signal from the copy thread. In embodiments, the pausing of the send thread requires extra synchronization between the copy and send threads and should not happen often. To optimize the efficiency, the reading rate of the send thread is configurable and can be matched to ensure similar movement of data, for example 4 MB per read. 
     In the case that the stored dirty pages are over the notification threshold, only two signals are needed. The first one is triggered when the notification threshold is reached; and the second one is sent after the copy is done. Since the second signal is sent after the VM is resumed, the second signal has no impact on suspension time. The above embodiments realize a unique ring buffer where the copying thread copies the dirty pages to the buffer while the send thread simultaneously chases the send thread and sends the dirty pages to the standby host. This ring buffer opens up new space in the ring buffer to reuse by the copy thread, until the send thread transmits the last dirty page in the buffer. 
     The terms “software thread” or “thread”, as used herein, can represent a unit of processing that can be scheduled by an operating system. A thread may consist of one or more lines of code that are executed by a processor to complete an action or set of actions. 
     The terms “section” of “portion”, as used herein, can represent a division of an object, structure, or thing. In terms of a ring buffer, a section or portion can be any division of the total capacity of the ring buffer whether delineated by hardware structure (e.g., a memory cell) or by a logical division. 
     The term “ring buffer”, as used herein, can mean a type of memory or storage system. A ring buffer can allow for sections of the ring buffer to be reused to store data. For example, a first set of data may be stored in a first section of the ring buffer. After that data is removed from the first set of data during the copying of data from a main memory to the ring buffer, second data can be stored in the first section of the ring buffer. Thus, the ring buffer is “circular”, in that, the sections of the ring buffer can be reused during a session of copying data to the ring buffer. 
     The term “threshold”, as used herein, can represent a limit. The threshold can be associated with data availability of a component, for example, the ring buffer. The threshold may be represented by a portion of a capacity of the component, e.g., 50% of the total capacity of the ring buffer. 
     The term “capacity”, as used herein, can represent a total amount of available memory space in a ring buffer. 
     The phrases “at least one”, “one or more,” and “and/or” are open-ended expressions that are both conjunctive and disjunctive in operation. For example, each of the expressions “at least one of A, B and C”, “at least one of A, B, or C”, “one or more of A, B, and C”, “one or more of A, B, or C” and “A, B, and/or C” means A alone, B alone, C alone, A and B together, A and C together, B and C together, or A, B and C together. 
     The term “a” or “an” entity refers to one or more of that entity. As such, the terms “a” (or “an”), “one or more” and “at least one” can be used interchangeably herein. It is also to be noted that the terms “comprising,” “including,” and “having” can be used interchangeably. 
     The term “automatic” and variations thereof, as used herein, refers to any process or operation done without material human input when the process or operation is performed. However, a process or operation can be automatic, even though performance of the process or operation uses material or immaterial human input, if the input is received before performance of the process or operation. Human input is deemed to be material if such input influences how the process or operation will be performed. Human input that consents to the performance of the process or operation is not deemed to be “material.” 
     The terms “determine”, “calculate” and “compute,” and variations thereof, as used herein, are used interchangeably and include any type of methodology, process, mathematical operation or technique. 
     The term “daemon” is a computer program that runs in the background, rather than under the direct control of a user; which are usually initiated as background processes. 
     The term “file system” is a method for storing and organizing computer files and the data they contain to make it easy to find and access them. File systems may use a computer readable medium and involve maintaining the physical location of the files. 
     The term “module” refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and software that is capable of performing the functionality associated with that element. Also, while the various concepts are described in terms of exemplary embodiments, it should be appreciated that aspects can be separately claimed. 
     The term “page” refers to a section of memory that is accessible at one time. 
     The term “virtual machine” includes system virtual machines (or hardware virtual machines), which provide a complete system platform to support the execution of a complete operating system, and process virtual machines (or process virtual machines), which run a single program that supports a single process. System virtual machines allow the sharing of the underlying physical machine resources between differing virtual machines, each running on its own operating system. Process virtual machines run as a normal application inside on operating system, are created when the supported process is started, and destroyed when the process exists. A common characteristic of a virtual machine is that the software running inside is limited to the resources and abstractions provided by the virtual machine. 
     Hereinafter, “in communication” shall mean any electrical connection, whether wireless or wired, that allows two or more systems, components, modules, devices, etc. to exchange data, signals, or other information using any protocol or format. 
     The preceding is a simplified summary to provide an understanding of some aspects of the embodiments. This summary is neither an extensive nor exhaustive overview of the various embodiments. It is intended neither to identify key or critical elements nor to delineate the scope of the embodiments but to present selected concepts in a simplified form as an introduction to the more detailed description presented below. As will be appreciated, other embodiments are possible utilizing, alone or in combination, one or more of the features set forth above or described in detail below. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The present disclosure is described in conjunction with the appended figures: 
         FIGS. 1A and 1B  are block diagrams of an embodiment of a system for providing HA protection to a VM; 
         FIGS. 2A and 2B  are a block diagram and logical diagram, respectively, of embodiments of a ring buffer used to copy memory pages for an HA protected VM; 
         FIGS. 3A and 3B  are a flow diagrams of an embodiment of a process for synchronizing disk storage between servers before initializing HA protection for a VM; 
         FIG. 4  is a block diagram of an embodiment of a computing environment operable to execute the HA protected VM; 
         FIG. 5  is a block diagram of an embodiment of a computer operable to execute as a server that operates a VM. 
     
    
    
     In the appended figures, similar components and/or features may have the same reference label. Further, various components of the same type may be distinguished by following the reference label by a letter that distinguishes among the similar components. If only the first reference label is used in the specification, the description is applicable to any one of the similar components having the same first reference label irrespective of the second reference label. 
     DETAILED DESCRIPTION 
     The ensuing description provides embodiments only, and is not intended to limit the scope, applicability, or configuration of the invention. Rather, the ensuing description will provide those skilled in the art with an enabling description for implementing the embodiments. Various changes may be made in the function and arrangement of elements without departing from the spirit and scope of the invention as set forth in the appended claims. 
     An embodiment of an environment generally operable to execute the system  100  is shown in  FIGS. 1A and 1B . The system  100  generally includes an active host (first server)  102  and a standby host (second server)  106 . The active host  102  and the standby host  106  can include computers or computing systems, such as a server, and can be referred to simply as “servers.” The active host  102  and the standby host  106  are generally computing systems as described in conjunction with  FIGS. 6 and 7 . In embodiments, the active host  102  and the standby host  106  are separate hardware devices. In some embodiments, it may be possible to include the active host  102  and the standby host  106  on a single hardware device, having two or more processors. However, the active host  102  and the standby host  106  will hereinafter be described as being separate computing systems. 
     The active host  102  and the standby host  106  can be in communication through a network  104 . The network  104  may be as described in conjunction with  FIGS. 6 and 7 . The network  104  may not be shown in subsequent drawings but is still provided to allow communication between the active host  102  and the standby host  106 . 
     The active host  102  and the standby host  106  include a processor  108   a  and/or  108   b , such as a microprocessor, to execute a virtual machine (VM)  114   a  and/or  114   b , a main memory  110   a  and/or  110   b , and disk storage  112   a  and/or  112 . Main memory  110  and disk storage  112  can be any suitable form of computer readable media. Typically, disk storage  112  is one or more of a floppy disk, a flexible disk, a hard disk, a magnetic tape, or any other magnetic medium, a magneto-optical medium, a CD-ROM, any other optical medium, punch cards, paper tape, and any other physical medium with patterns of holes. In one configuration, the processor  108  and main memory  110  are collocated, while the disk storage  112  is located remotely wherefrom. Main memory  110  can also store one or more of data, executable code, states, or other information for the one or more VMs  114 . Disk storage  112  can store disk writes for the one or more VMs  114 . The disk writes can include one or more items of data or other information that is to be stored. 
     In embodiments, the active host  102  executes one or more VMs  114 . A virtual machine  107  is a software implementation of a “machine” (e.g., a computing system) that executes applications or programs like a physical computing system or machine. The memory image and disk writes (which can correspond to a memory session and a “filesystem” associated with a virtual machine) for the virtual machine  107   a  are synchronized, mirrored, or replicated to the standby host  106  for the “back-up” or “standby” virtual machine  107   b , which is not executing while virtual machine  107   a  is executing on the active host  102 . In the event that the active host  102  fails or is no longer able to execute the virtual machine  107   a , the active VM  114   a  “fails over” to the standby host  106 , which can assume the execution of the standby VM  114   b . As such, the combination of the active host  102  and standby host  106  provide high availability for the VM  114 . 
     Another embodiment of the system  100 , showing components or modules executed by the active host  102  and the standby host  106 , is shown in  FIG. 1B . The components or modules shown in  FIG. 1B  may be software modules or processes executed by a processor  108  and stored in main memory  110  of the active host  102  and the standby host  106 , may be logic circuits incorporated into the hardware of the active host  102  and the standby host  106 , or some combination thereof. In embodiments, the components or modules shown in  FIG. 1B  help maintain the high availability of the virtual machine  107 . The components or modules include one or more of, but are not limited to, an infrastructure service module  116   a  and  116   b , a virtual machine replication daemon (VMRD)  118   a  and  118   b , a virtual machine replication engine (VMRE)  120   a  and  120   b  (which can include a checkpoint control module  122   a  and  122 , a disk control module  124   a  and  124   b , and a memory replication module  126   a  and  126   b ), and a distributed replicated block device (DRBD)  128   a  and  128   b.    
     The infrastructure service module  116  is a daemon that can provide communication or membership services to a client. The infrastructure service module  116  allows clients to know about the presence of a process on another machine. For example, the infrastructure service module  116  on the standby host  106  would want to know about the presence of the active VM  114   a  on the active host  102 . If the active VM  114   a  is not present, the standby host  106  would know to execute the standby VM  114   b . An example of an infrastructure service module  116  is Heartbeat offered as open source software for Linux. The VMRD  118  and the VMs  114  may be members to which the infrastructure service module  116  determines presence or provides presence status. The infrastructure service module  116  can send a “manage” signal to the VMRD  118 , which can cause the VMRD  118  to create a standby VM  114   b  or synchronize or update the standby VM  114   b.    
     The VMRD  118  is a daemon process to manage the VMRE  120 . To accomplish the replication, the VMRD  118  can send “control” signals to the VMRE  120 , such as start/stop VMRE  120 , promote/demote VMRE  120 , which, in turn, activates/destroys the VM  114 . Further, the VMRD  118   a  on the active host  102  can communicate to the VMRD  118   b  on the standby host  106  using a VMRD protocol. The communications, between the VMRD  118   a  and the VMRD  118   b , help coordinate the replication of data from the active host  102  to the standby host  106  and coordinate a graceful switchover. The VMRD  118  has two different roles: “active” or “standby” depending on whether the VMRD  118  is running on the active host  102  or the standby host  106 . The active VMRD  118   a  is capable of detecting the existence of the standby VMRD  118   b . Once the communications between VMRD  118   a  and VMRD  118   b  is established, VMRD  118   a  can start VM protection by starting the VMRE  120   a.    
     A VMRE  120  manages the replication of the active VM  114   a  to the standby VM  114   b . The VMRE  120  can manage the initial replication and subsequent, periodic updates of the active VM  114   a  to the standby host  106 . It should be noted that the active VM  114   a  can be a running VM. As such, the VMRE  120   a  can manage replication after the active VM  114   a  is running and without stopping the execution of the active VM  114   a . The VMRE  120  may include a checkpoint control module  122 , a disk control module  124 , and a memory replication module  126 . The checkpoint control module  122  controls the replication of the main memory  110  and the disk storage  112 . Both the main memory  110  and disk storage  112  must be replicate in a manner that allows the standby host  106  to execute the VM  114 . There are several processes or methods for controlling the replication. 
     In one technique implemented by a software system Remus™, periodic “snapshots” of the file system, network (session), and VM output cache in main memory  110  states of a selected active VM  114   a  are replicated at relatively high frequencies (e.g., every 20 to 40 milliseconds). In another technique implemented by a software system sold by Paragon Software Group™ under the tradename Snapshot™, a file system writes selected first data blocks to a computer readable medium, marking them with pointers. A snapshot is taken (e.g., of the file system, network, and VM output cache states of the active first, second, . . . nth virtual machines  152   a - n ), without any data being read, written or copied to the computer readable medium. The snapshot simply points to the current locations. As will be appreciated, other mirroring techniques may be used, such as the techniques used by Double-Take™, from Double-Take™ Software. 
     The checkpoint control module  122  can control the actions of the memory replication module  126  and the disk control module  124 . The checkpoint control module  122  can communicate through a defined CKPT control protocol to achieve synchronized memory and disk replication. As such, the checkpoint control module  122  ensures that the replication of information from the disk storage  112  and the main memory  110  is in sync. How the checkpoint control module  122  controls the replication process is explained in U.S. patent application Ser. No. 12/711,968, entitled “Method and Apparatus for High Availability (HA) Protection of a Running Virtual Machine (VM),” to Chou et al., filed Feb. 24, 2010, which is incorporated by reference in its entirety for all that it teaches. 
     A memory replication module  126  can replicate the data in main memory  110   a  to the standby host  106 . In embodiments, the memory replication module  126  stores data from the main memory  110   a  associated with the active VM  114   a  to a buffer. From the buffer, the data is sent to the main memory  110   b  of the standby VM  114   b . The memory replication module  126  may use a migration process available with XenServer, available through Citrix Systems. 
     Similar to the memory replication module  126 , the disk control module  124  helps replicate data from one or more disks on the active host  102  to the standby host  106 . The disk control module  124  may control a DRBD  128 . DRBD  128  is a distributed storage system that may be similar to RAID  1 , except that DRBD  128  runs over the network  104 . DRBD  128  refers to both the software and also to logical block devices (e.g., the disk storage  112 ) managed by the software. DRBD  128  copies disk writes from the disk storage  112   a  to disk storage  112   b.    
     Embodiments of data structures used to copy a memory image or data, associated with an active VM  114   a , from main memory  110   a  in the active host  102  to the main memory  110   b  in the standby host  106  are shown in  FIG. 2 . Here, the main memory  110   a  and the main memory  110   b  include one or more pages of memory  202   a  through  210   a  and  202   b  through  210   b , respectively. During initialization of high availability, the entire memory image for the active VM  114   a  will be migrated to the main memory  110   b  of the standby host  106 . However, after initialization of high availability, the active host  102  may mark particular memory pages (e.g., pages  204   a ,  208   a , and/or  210   a ) dirty with a marker  212 . The marker  212  may be any data element that can mark a memory page as having been changed from some moment in time. The dirty memory pages can be copied to a separate ring buffer  214 . From the ring buffer  214 , the active host  102  may send the dirty memory pages to the standby host  106  to store in the main memory  110   b  of the standby host  106 . 
     The ring buffer  214  can have several sections that store one or more dirty memory pages. For example, the ring buffer  214  can include a first section  220   a  that stores a first dirty memory page. One or more sections  220  can store other dirty memory pages. The last section  220   b  can be the last section of the ring buffer  214  that can store memory pages. The ring buffer  214  can have more or fewer sections than those shown in  FIG. 2 , as represented by ellipses  222 . Once the active host  102  moves a dirty memory page into the last section  220   b  of the ring buffer  214 , the active host  102  can return to the first section  220   a  and store another dirty memory page in the first section  220   a . As such, the ring buffer  214  can provide a buffer with almost unlimited storage as long as the dirty memory pages are sent to the standby host before the active host  102  returns to the section to store a new dirty memory page. 
     Thus, the ring buffer  214  can execute or communicate with two software threads. A first thread is the copy thread, which is generally shown as the group of actions  218 . The copy thread  218  can copy dirty memory pages  204   a ,  208   a , and/or  210   a  from the main memory  110   a  into the ring buffer  214 . The copy thread  218  can copy dirty memory pages into subsequent sections  220  of the ring buffer  214  and return to the first section  220   a  when all sections of the ring buffer  214  have been used. 
     The second thread is a send thread generally represented by the group of actions  224 . The send thread  224  can copy data from the sections  220  of the ring buffer  214  and send the data to the standby host  110   b . To accommodate both the copy thread  218  and the send thread  224 , the send thread  224  executes on different sections of the ring buffer  214  than the copy thread  218 . In embodiments, the send thread  224  executes on sections  220  of the ring buffer  214  already used by the copy thread  218 , which has already stored dirty memory pages in those sections  220   a  executed upon by the send thread  224 . For example and as shown in  FIG. 2 , the copy thread  218  has already stored dirty memory pages in section  220   a  and the sections  220  immediately adjacent to section  220   a . The copy thread  218  is now storing dirty memory pages in section  220   b . Meanwhile, the send thread  224  is copying data from section  220   a  and the adjacent sections  220 . The send thread  224  can free sections (e.g., section  220   a ) of the ring buffer  214  for the copy thread  218  to thereinafter use to store more dirty memory pages to the ring buffer  214 . Thus, if the copy thread  218  has stored a dirty memory page in a last section  220   b  of the ring buffer  214  and still needs to store at least one other dirty memory page, the copy thread can store a next dirty memory page in the first section  220   a  of the ring buffer  214 , which has been previously freed by the send thread  224 . 
     To trigger the send thread, a threshold  216  can be created. The threshold  216 , in embodiments is predetermined and can be associated with a portion of the capacity of the ring buffer. Thus, the threshold  216  can be measured by capacity or by a predetermined section  220  within the ring buffer  214 . For example, the threshold  216  can be set at 50% of the capacity of the ring buffer  214 . Thus, once 50% of the ring buffer  214  has been used to store the dirty memory pages, the send thread  224  is triggered to start. In a second example, the send thread  224  is triggered after section  220   c  has been used to store dirty memory page data. Either of these methods or other methods are contemplated to set the threshold  216 . The threshold  216  can be set by a user. Once the threshold  216  is reached, the send thread  224  begins to execute at some other predetermined location to free sections  220  of the ring buffer  214  for future storage by the copy thread  218 . 
     Further, the copy thread  218  may also trigger the send thread  224  when the copy thread  218  has completed copying data into the ring buffer  214 . Thus, in the situation when the amount of data copied into the ring buffer  214  does not reach the threshold  216 , the copy thread  218  triggers the send thread  224  to begin moving data to the standby host  106 . 
     In embodiments, the send thread  224  is throttled. Throttling controls the rate of transfer for the send thread  224 . It is possible for the send thread  224  to quickly transfer data from the ring buffer  214  to the standby host  106 . The speed of the transfer may allow the send thread  224  to “catch” the copy thread. In these situations, the send thread  224  may pause and wait until either the threshold  216  is again reached or until the copy thread  218  stops execution and triggers the send thread  224 . However, the speed of the send thread  224  can cause the TCP connection with the standby host  106  to become overwhelmed. Further, the notification messages between the copy thread  218  and the send thread  224  cause extra, and unwanted or unnecessary, signal traffic. Thus, the send thread  224  can be throttled, such that, the speed of data transfer of the copy thread  218  and the send thread  224  are substantially similar. In embodiments, this rate of data transfer is 4 MB per read. 
     A logical representation of a ring buffer  214  is shown in  FIG. 2B . The ring buffer  214  can include a plurality of memory locations, each memory location having a memory address. The ring buffer  214  can be logically arranged such that the ring buffer  214  has a first memory address  225 . The first or start memory address  225  can be the first location to store a portion of the data in the ring buffer. Further, the ring buffer  214  can have a last logical location to store data. The last location stores that last portion of data before storing data again at the first memory address  225 . The last location may have a last memory address  232 . Depending on the type of memory device used, the memory locations may hold different amounts of data (e.g., 4 Mbytes, 64 Mbytes, etc.). The memory locations after the first memory location can be logically arranged such that the memory forms a continuous buffer until an last memory location. After the last memory location, data is again stored in the first memory location and continues to be stored in the consecutive memory locations. 
     The ring buffer  214  operates such that the write thread  218  storing data into the ring buffer  214  operates asynchronously from a read thread  225  which retrieves data from the ring buffer  214 . As such, the write thread  218  may store data starting in the start address  225 . The writing of dirty memory pages may continue until the amount of data stored in the ring buffer crosses or reaches a predetermined threshold. The threshold may be set by the user or automatically based on the speed of the read and write threads. In embodiments, the threshold can be computed as a specific memory address, such as memory address  228 . Thus, if data is stored in the memory location identified by address  228 , the read thread  224  may be triggered. 
     In other embodiments, the amount of data stored is calculated. The calculation can be completed by determining the number of memory locations between the last location where data was stored (e.g., memory address  228 ) and first location where data was stored (e.g., memory address  225 ) and multiplying the number of determined memory locations by the amount of data stored in each memory location. This amount of data may be compared to a threshold amount of data, which may be set by the user. For example, the read thread may be triggered after 4 MB of memory have been stored. Thus, if the amount of data already stored in the ring buffer is the same or more than 4 MB, the read thread  224  can be triggered. Thus, if the write thread  218  is storing data into memory location  226 , but the threshold is at memory address  228 , the read thread will not be triggered. However, if the write thread  218  reaches memory address  230 , the read thread  224  can be triggered. This method allows for the triggering of the read thread  224  to be repeated as the calculation does not depend on any specific memory address. Further, this method allows the user to set the threshold easily by simply selecting an amount of data to represent the threshold. 
     Once the amount of data that has been stored reaches or passes the threshold and the read thread  224  is triggered, the read thread  224  may operate to remove data in the ring buffer  214 . The removal of data from the ring buffer  218  can occur at speeds different from than the write thread  224 . Thus, the read thread  224  can remove all data in the ring buffer from addresses  225  to  228  in a single read. The read thread  224  may generally be faster than the write thread and allow for transmission of larger portions of data. In other embodiments, the read thread  224  may execute one or more reads to remove the data between address  225  and address  228 . In other embodiments, the read thread  224  may read data until the read thread  224  catches the write thread  218 . In this case, the read thread  224  ceases to execute as there is no more data to read. After ceasing to execute, the read thread  224  may pause or may need to be re-triggered when the write thread  218  has stored a new set of data that is more than the threshold. 
     The operation of the write thread continues until all dirty memory pages from the main memory  110   a  is written into the ring buffer  214  by the write thread  218 . If the amount of data written into the ring buffer  214 , by the write thread  218 , does not reach the threshold but completes the transfer of dirty memory pages from the main memory  110   a , the write thread  218  stops and triggers the read thread  224  to begin removing data from the ring buffer  214 , although the threshold has not been reached. 
     An embodiment of a method  300  for moving data through a ring buffer  214  using asynchronous read and write threads is shown in  FIGS. 3A and 3B .  FIG. 3A  shows the process of executing the write thread  218 , while  FIG. 3B  shows the process of the read thread  224 . Generally, the method  300 ,  318  begins with a start operation  302 ,  320  and terminates with an operation  316 ,  330 . The method  300 ,  318  can represent how data is transferred during memory replication as explained in U.S. patent application Ser. No. 12/711,968, entitled “Method and Apparatus for High Availability (HA) Protection of a Running Virtual Machine (VM),” to Chou et al., filed Feb. 24, 2010, which is incorporated by reference in its entirety for all that it teaches and for all purposes. While a general order for the steps of the method  300 ,  318  are shown in  FIGS. 3A and 3B , the method  300 ,  318  can include more or fewer steps or arrange the order of the steps differently than those shown in  FIGS. 3A and 3B . The method  300 ,  318  can be executed as a set of computer-executable instructions executed by a computer system and encoded or stored on a computer readable medium. Hereinafter, the method  300 ,  318  shall be explained with reference to the systems, components, modules, software, data structures, etc. described in conjunction with  FIGS. 1-2B . 
     The VM replication engine  120 A suspends the virtual machine, in step  304 . In embodiments, when replication begins the VM is suspended to copy dirty pages (e.g.,  204   a ) from the main memory  110   a  into the ring buffer  214 . The memory replication module  126   a  copies data from the main memory  110   a  into the ring buffer  214 , in step  306 . In embodiments, the memory replication module  126   a  starts the write thread  218  to copy dirty pages, for example,  204   a ,  208   a , and/or  210   a  into the ring buffer  214 . The write thread  218  starts copying the dirty memory pages into the first address  220   a , which may be represented as memory address  225  in  FIG. 2B . As the dirty memory pages are copied, the memory replication model  126   a  determines if the amount of memory copied into the ring buffer  214  meets a threshold, represented by line  216  in  FIG. 2A . This threshold  216  may represent an amount of memory in the ring buffer, for example a predetermined number of memory addresses ending with memory address  228  in  FIG. 2B . If the threshold is reached, step  308  proceeds YES to step  312 . If the threshold is not reached, step  308  proceeds NO to step  310 . 
     In step  310 , a determination is made, by the memory replication module  126   a , whether the copy of dirty memory pages is complete. In embodiments, the memory replication module  126   a  determines if all dirty memory pages have been copied from the main memory  110   a  into the ring buffer  214 . If all dirty memory pages have been copied, step  310  proceeds YES to step  312 . If some of the dirty memory pages have yet to be copied, step  310  proceeds NO back to step  306  where the write thread  218  continues to copy dirty memory pages from the main memory  110  into the ring buffer  214 . In step  312 , the memory replication module  126   a  notifies the read thread  224  to begin copying data from the ring buffer  214  to the standby host  106 . As such, the read thread  224  begins moving data from the ring buffer  214  to the standby host main memory  110   b . The read thread  224  does not operate synchronously with the write thread  218  but may copy data at a speed different from or in quantities different from the write thread  218 . As such, the write thread  218  and the read thread  224  are decoupled and require no communication between the two to execute. The read thread  224  can copy all the data in the ring buffer  214  to the standby host  106 , until read thread  224  catches the write thread  218 . In other embodiments, the read thread  224  will only read the portion of data that represents the data stored in the ring buffer  214  up to the threshold. For example, the read thread  224  may only copy the data from memory address  225  to memory address  228  and then stop executing. Thus, if the write thread  218  copies more dirty pages into the ring buffer  214 , the read thread  224  will need to be re-activated to read that additional data and send the data to the standby host main memory  110   b.    
     After the data is copied from the main memory  110   a  into the ring buffer  214 , the memory replication module  126   a  can signal the VM replication engine  102   a  to resume the virtual machine. The resumption of the virtual machine is not dictated by the process of reading data from the ring buffer  214 . Thus, after the write thread  218  has completed and stops, the virtual machine may be resumed while the read thread  224  continues to copy dirty memory pages to the standby host main memory  110   b . Thus, this process  300  allows for the decoupling of the read thread  224  and write threads  218 , while also minimizing the amount of time that the virtual machine is suspended. 
     An embodiment of a method for executing a read thread  224 , is shown in  FIG. 3B . A memory replication module  126   a  can send a signal to a read thread  224  to begin copying dirty pages out of a ring buffer  214 . The read thread  224  can determine if a read signal is received, in step  322 . Thus, if the read thread  224  executed by the memory replication module  126 B receives the read signal, step  322  proceeds YES to step  324 . If no signal has been received, step  322  proceeds NO to wait and determine, at some future time, if a read signal is received. 
     In step  324 , the read thread  224  begins to read dirty memory pages from the ring buffer  214 . The read thread  224  can begin reading the dirty memory pages from a start memory address  225 . Further, the read thread  224  does not need to execute at the same speed or be coupled to the write thread  218 . As such, the read thread  224  can copy data at any speed or copy different sized blocks of data from the ring buffer  214 . 
     Once the data is read from the ring buffer  214 , the read thread  224  sends the dirty memory pages to the standby host  106  to be stored in the main memory  110   b , in step  326 . The transmission of the data can be in any size blocks or at any speed. Thus, the read thread  224  can execute asynchronously from the write thread  218 . The read thread  224  continues copying and sending dirty memory pages until it reaches a point where it is completed or the ring buffer  214  is empty. 
     Periodically, the memory replication module  126 B can determine if the buffer is empty, in step  328 . In embodiments, the read thread  224  reads only dirty memory pages from a select portion of the ring buffer  214 . For example, the read thread  224  reads only the data from address  225  to address  228 . In other embodiments, the read thread  224  reads all the memory until it catches the write thread  218  and then ceases to execute. In other embodiments, the read thread  224  reads all the data in the ring buffer  214  until the ring buffer  214  is empty. The determination of whether to stop executing, in step  328 , can stop or pause the read thread  224  for a period of time or permanently. If the buffer is empty step  328  proceeds yes to end operation  330 . If the buffer is not empty, step  328  proceeds NO back to step  324  to continue reading dirty memory pages. 
       FIG. 4  illustrates a block diagram of a computing environment  400  wherein the active host  102  and the standby host  104  may execute to provide HA for a VM executing on commodity hardware. As such, the system or components described in conjunction with  FIG. 4  may be commodity hardware. The computing environment  400  includes one or more user computers  405 ,  410 , and  415 . The user computers  405 ,  410 , and  415  may be general purpose personal computers (including, merely by way of example, personal computers, and/or laptop computers running various versions of Microsoft Corp.&#39;s Windows™ and/or Apple Corp.&#39;s Macintosh™ operating systems) and/or workstation computers running any of a variety of commercially-available UNIX™ or UNIX-like operating systems. These user computers  405 ,  410 ,  415  may also have any of a variety of applications, including for example, database client and/or server applications, and web browser applications. Alternatively, the user computers  405 ,  410 , and  415  may be any other electronic device, such as a thin-client computer, Internet-enabled mobile telephone, and/or personal digital assistant, capable of communicating via a network (e.g., the network  420  described below) and/or displaying and navigating web pages or other types of electronic documents. Although the exemplary computing environment  400  is shown with three user computers, any number of user computers may be supported. 
     Computing environment  400  further includes a network  420 . The network  420  can be any type of network familiar to those skilled in the art that can support data communications using any of a variety of commercially-available protocols, including without limitation SIP, TCP/IP, SNA, IPX, AppleTalk, and the like. Merely by way of example, the network  420  maybe a local area network (“LAN”), such as an Ethernet network, a Token-Ring network and/or the like; a wide-area network; a virtual network, including without limitation a virtual private network (“VPN”); the Internet; an intranet; an extranet; a public switched telephone network (“PSTN”); an infra-red network; a wireless network (e.g., a network operating under any of the IEEE 402.11 suite of protocols, the Bluetooth™ protocol known in the art, and/or any other wireless protocol); and/or any combination of these and/or other networks. The network  420  may be the same or similar to network  104 . 
     The system may also include one or more server computers  425 ,  430 . One server may be a web server  425 , which may be used to process requests for web pages or other electronic documents from user computers  405 ,  410 , and  420 . The web server can be running an operating system including any of those discussed above, as well as any commercially-available server operating systems. The web server  425  can also run a variety of server applications, including SIP servers, HTTP servers, FTP servers, CGI servers, database servers, Java servers, and the like. In some instances, the web server  425  may publish operations available operations as one or more web services. 
     The computing environment  400  may also include one or more file and or/application servers  430 , which can, in addition to an operating system, include one or more applications accessible by a client running on one or more of the user computers  405 ,  410 ,  415 . The server(s)  430  may be one or more general purpose computers capable of executing programs or scripts in response to the user computers  405 ,  410  and  415 . As one example, the server may execute one or more web applications. The web application may be implemented as one or more scripts or programs written in any programming language, such as Java™, C, C#™, or C++, and/or any scripting language, such as Perl, Python, or TCL, as well as combinations of any programming/scripting languages. The application server(s)  430  may also include database servers, including without limitation those commercially available from Oracle, Microsoft, Sybase™, IBM™ and the like, which can process requests from database clients running on a user computer  405 . 
     The web pages created by the web application server  430  may be forwarded to a user computer  405  via a web server  425 . Similarly, the web server  425  may be able to receive web page requests, web services invocations, and/or input data from a user computer  405  and can forward the web page requests and/or input data to the web application server  430 . In further embodiments, the server  430  may function as a file server. Although for ease of description, FIG.  4  illustrates a separate web server  425  and file/application server  430 , those skilled in the art will recognize that the functions described with respect to servers  425 ,  430  may be performed by a single server and/or a plurality of specialized servers, depending on implementation-specific needs and parameters. The computer systems  405 ,  410 , and  415 , file server  425  and/or application server  430  may function as the active host  102  and/or the standby host  104 . 
     The computing environment  400  may also include a database  435 . The database  435  may reside in a variety of locations. By way of example, database  435  may reside on a storage medium local to (and/or resident in) one or more of the computers  405 ,  410 ,  415 ,  425 ,  430 . Alternatively, it may be remote from any or all of the computers  405 ,  410 ,  415 ,  425 ,  430 , and in communication (e.g., via the network  420 ) with one or more of these. In a particular set of embodiments, the database  435  may reside in a storage-area network (“SAN”) familiar to those skilled in the art. Similarly, any necessary files for performing the functions attributed to the computers  405 ,  410 ,  415 ,  425 ,  430  may be stored locally on the respective computer and/or remotely, as appropriate. In one set of embodiments, the database  435  may be a relational database, such as Oracle 10i™, that is adapted to store, update, and retrieve data in response to SQL-formatted commands. 
       FIG. 5  illustrates one embodiment of a computer system  500  upon which the active host  102 , the standby host  104 , or other systems or components described herein may be deployed or executed. The computer system  500  is shown comprising hardware elements that may be electrically coupled via a bus  555 . The hardware elements may include one or more central processing units (CPUs)  505 ; one or more input devices  510  (e.g., a mouse, a keyboard, etc.); and one or more output devices  515  (e.g., a display device, a printer, etc.). The computer system  500  may also include one or more storage devices  520 . By way of example, storage device(s)  520  may be disk drives, optical storage devices, solid-state storage devices such as a random access memory (“RAM”) and/or a read-only memory (“ROM”), which can be programmable, flash-updateable and/or the like. 
     The computer system  500  may additionally include a computer-readable storage media reader  525 ; a communications system  530  (e.g., a modem, a network card (wireless or wired), an infra-red communication device, etc.); and working memory  540 , which may include RAM and ROM devices as described above. In some embodiments, the computer system  500  may also include a processing acceleration unit  535 , which can include a DSP, a special-purpose processor, and/or the like. 
     The computer-readable storage media reader  525  can further be connected to a computer-readable storage medium, together (and, optionally, in combination with storage device(s)  520 ) comprehensively representing remote, local, fixed, and/or removable storage devices plus storage media for temporarily and/or more permanently containing computer-readable information. The communications system  530  may permit data to be exchanged with the network  420  and/or any other computer described above with respect to the computer system  500 . Moreover, as disclosed herein, the term “storage medium” may represent one or more devices for storing data, including read only memory (ROM), random access memory (RAM), magnetic RAM, core memory, magnetic disk storage mediums, optical storage mediums, flash memory devices and/or other machine readable mediums for storing information. 
     The computer system  500  may also comprise software elements, shown as being currently located within a working memory  540 , including an operating system  545  and/or other code  550 . It should be appreciated that alternate embodiments of a computer system  500  may have numerous variations from that described above. For example, customized hardware might also be used and/or particular elements might be implemented in hardware, software (including portable software, such as applets), or both. Further, connection to other computing devices such as network input/output devices may be employed. 
     In the foregoing description, for the purposes of illustration, methods were described in a particular order. It should be appreciated that in alternate embodiments, the methods may be performed in a different order than that described. It should also be appreciated that the methods described above may be performed by hardware components or may be embodied in sequences of machine-executable instructions, which may be used to cause a machine, such as a general-purpose or special-purpose processor or logic circuits programmed with the instructions to perform the methods. These machine-executable instructions may be stored on one or more machine readable mediums, such as CD-ROMs or other type of optical disks, floppy diskettes, ROMs, RAMs, EPROMs, EEPROMs, magnetic or optical cards, flash memory, or other types of machine-readable mediums suitable for storing electronic instructions. Alternatively, the methods may be performed by a combination of hardware and software. 
     Specific details were given in the description to provide a thorough understanding of the embodiments. However, it will be understood by one of ordinary skill in the art that the embodiments may be practiced without these specific details. For example, circuits may be shown in block diagrams in order not to obscure the embodiments in unnecessary detail. In other instances, well-known circuits, processes, algorithms, structures, and techniques may be shown without unnecessary detail in order to avoid obscuring the embodiments. 
     Also, it is noted that the embodiments were described as a process which is depicted as a flowchart, a flow diagram, a data flow diagram, a structure diagram, or a block diagram. Although a flowchart may describe the operations as a sequential process, many of the operations can be performed in parallel or concurrently. In addition, the order of the operations may be re-arranged. A process is terminated when its operations are completed, but could have additional steps not included in the figure. A process may correspond to a method, a function, a procedure, a subroutine, a subprogram, etc. When a process corresponds to a function, its termination corresponds to a return of the function to the calling function or the main function. 
     Furthermore, embodiments may be implemented by hardware, software, firmware, middleware, microcode, hardware description languages, or any combination thereof. When implemented in software, firmware, middleware or microcode, the program code or code segments to perform the necessary tasks may be stored in a machine readable medium such as storage medium. A processor(s) may perform the necessary tasks. A code segment may represent a procedure, a function, a subprogram, a program, a routine, a subroutine, a module, a software package, a class, or any combination of instructions, data structures, or program statements. A code segment may be coupled to another code segment or a hardware circuit by passing and/or receiving information, data, arguments, parameters, or memory contents. Information, arguments, parameters, data, etc. may be passed, forwarded, or transmitted via any suitable means including memory sharing, message passing, token passing, network transmission, etc. 
     While illustrative embodiments n have been described in detail herein, it is to be understood that the concepts may be otherwise variously embodied and employed, and that the appended claims are intended to be construed to include such variations, except as limited by the prior art.