libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Why MHD latency is so high on Windows?


From: silvioprog
Subject: Re: [libmicrohttpd] Why MHD latency is so high on Windows?
Date: Wed, 18 Nov 2015 13:27:39 -0300

On Wed, Nov 18, 2015 at 10:20 AM, Evgeny Grin <address@hidden> wrote:
Hi!
 
libmicrohttpd was ported to use Windows API directly, so PlibC wrapper is not used anymore.

Very nice.
 
According to MSDN docs there is no TCP_FASTOPEN flag on Windows: https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms738596(v=vs.85).aspx
It also not present in any header file from VS 2010, 2012, 2013, 2015 and in MinGW-w64 headers.
How did you compile MHD?

I used CLion configured to use the same MinGW from CodeBlocks.
 
MHD currently has no cmake files. Only autotools files for build on Linux/Unix/Darwin/MinGW/Cygwin and Visual Studio 2013 project for Windows builds.

CLion creates an initial CMakeLists.txt, so I just configured it. This is my CMakeLists content:

=== begin code ===

cmake_minimum_required(VERSION 3.3)
project(microhttpd)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

add_definitions(-DWIN32)
add_definitions(-DTCP_FASTOPEN)

include_directories(src/microhttpd)
include_directories(src/include)
include_directories(w32/VS2013)

set(SOURCE_FILES
    w32/VS2013/MHD_config.h
    src/microhttpd/base64.c
    src/microhttpd/connection.c
    src/microhttpd/daemon.c
    src/microhttpd/internal.c
    src/microhttpd/md5.c
    src/microhttpd/md5.h
    src/microhttpd/memorypool.c
    src/microhttpd/memorypool.h
    src/microhttpd/mhd_mono_clock.c
    src/microhttpd/postprocessor.c
    src/microhttpd/reason_phrase.c
    src/microhttpd/response.c
    src/platform/w32functions.c)

add_library(microhttpd SHARED ${SOURCE_FILES})
target_link_libraries(microhttpd ws2_32)

=== end code ===
 
If you just add "#define TCP_FASTOPEN 1" to some header, this misled MHD. On Win32 option TCP_NODELAY has value of 1. So instead of enabling TCP_FASTOPEN, you forced MHD to disable Nagle's algorithm (disabling is not recommend according to MSDN).

Indeed. I added it using `add_definitions(-DTCP_FASTOPEN)`.

So, what does MHD work using `TCP_NODELAY` on Windows? :-/

However I need to test the `TCP_NODELAY` flag, I didn't know that this flag existed.

--
Silvio Clécio

reply via email to

[Prev in Thread] Current Thread [Next in Thread]