apache / trafficserver

Apache Traffic Serverâ„¢ is a fast, scalable and extensible HTTP/1.1 and HTTP/2 compliant caching proxy server.
https://trafficserver.apache.org/
Apache License 2.0
1.8k stars 798 forks source link

Memory map: mmap+memcopy instead pread+pwrite #11484

Open monkuta opened 3 months ago

monkuta commented 3 months ago

Allows for only-in-memory caching for usecases where such behavior is needed (i.e. Live Video caching). It maps storage directly into user space memory, so reads and writes are being done by a memcpy (without calls to io).

To build: cmake -B build -DENABLE_HWLOC=ON -DENABLE_MMAP=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF cmake --build build -j cmake --install build

JosiahWI commented 3 months ago

Thanks for making the PR against the master branch. Should #10832 be closed?

monkuta commented 3 months ago

Yes #10832 should be closed. As per the comment, it has been merged into the master branch.

bneradt commented 3 months ago

[approve ci]

JosiahWI commented 3 months ago

@monkuta Please run cmake --build build --target format.

monkuta commented 3 months ago

Changes have been made. (https://github.com/apache/trafficserver/pull/11484/commits/6df2474f6d6735ca49f0f7c2f52eb0791317ff6a)

bryancall commented 3 months ago

@monkuta Do you have benchmarking number without and with this change?

moleksy commented 2 months ago

@bryancall For 1MB objects, 100% cache hit ratio mean latency drops from 800ms to 23ms @ 33.27GiB/s transfer rate. The achievable transfer rate for 50kB objects at 100% cache hit ratio is 4.84GiB/s compared to 0.94GiB/s for baseline at comparable latencies.