1. A system comprising: a plurality of local devices each including a memory and a processor; a distributed WAN (Wide Area Network) optimization virtual appliance, wherein the distributed WAN optimization virtual appliance comprises a plurality of virtual machines provided by virtualization software running on the plurality of local devices including at least a first virtual machine running on a first local device of the plurality of local devices and a second virtual machine running on a second local device of the plurality of local devices, a portion of resources of the first local device are allocated to the first virtual machine; a distributed WAN optimization application running at least on the first and second virtual machines; a virtualization software switch provided on each of the plurality of local devices, wherein the virtual machines of the distributed WAN optimization virtual appliance communicate with other devices on a network via the virtualization software switch running in the virtualization software, the virtualization software switch associated with the first virtual machine and running on the first local device being configured to forward or redirect a WAN data transmission request associated with the first local device and a remote device external to the distributed WAN optimization virtual appliance that communicates with the first local device via a WAN to the distributed WAN optimization application running on the first virtual machine; and a distributed database comprising resources of two or more of the plurality of local devices that are allocated by the virtualization software to the distributed WAN optimization virtual appliance; wherein the distributed WAN optimization application running on the first virtual machine is configured to: perform WAN or Internet caching of data received from the remote device across the WAN in the distributed database, and data segment caching by storing one or more data segments transmitted to the remote device from one of the plurality of local devices and a segment signature for each stored segment in the distributed database; receive, via the virtualization software switch running on the first local device, the data transmission request, wherein the data transmission request is one of a request to receive data from the remote device, and a request to transmit data to the remote device; responsive to the received data transmission request requesting to receive data from the remote device, search the distributed database to determine whether the data requested to be received has already been received from the remote device by one or more of the plurality of local devices associated with the distributed database and, when it is determined that the data requested to be received has already been received from the remote device by one or more of the plurality of local devices associated with the distributed database, fulfill the data transmission request using data stored in the distributed database by sending to the first local device the data requested to be received from a local device of the plurality of local devices that is storing the data requested to be received; and responsive to the received data transmission request requesting to transmit data to the remote device, determine, by a lookup in the distributed database, that one or more data segments of the data requested to be transmitted was previously transmitted to the remote device by one or more of the plurality of local devices associated with the distributed database and fulfill the data transmission request by retrieving and transmitting stored segment signatures for the one or more determined data segments from the distributed data to the remote device.