Skip to content

Commit

Permalink
Windows port - improve performance by using segment heap
Browse files Browse the repository at this point in the history
When sysbench is run with many threads, a lot of CPU is spent on memory
allocation and freeing. Profiler shows as much as 80 percent in malloc/free
code, when oltp_read_only is run with 1000 threads.

This does not happen when using SegmentHeap. There, at most 25% time is
spend on allocation and freeing, and the OLTP tps/qps numbers are better.

This patch uses windows application manifest to define heapType=SegmentHeap
for the sysbench executable. If not desired, -DWITH_SEGMENT_HEAP=0 cmake
parameter will disable the segment heap.
  • Loading branch information
vaintroub committed Sep 11, 2023
1 parent 1115e7d commit 61b18b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/win/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
target_sources(sysbench PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/sb_win_posix.h
${CMAKE_CURRENT_SOURCE_DIR}/sb_win_posix.c)
option(WITH_SEGMENT_HEAP "Use Windows segment heap, for better performance" ON)
if(WITH_SEGMENT_HEAP)
target_sources(sysbench PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/segment_heap.manifest)
endif()
target_include_directories(sysbench PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
7 changes: 7 additions & 0 deletions src/win/segment_heap.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2020/WindowsSettings">
<heapType>SegmentHeap</heapType>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

0 comments on commit 61b18b1

Please sign in to comment.