[Top][All Lists]

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

[libmicrohttpd] New Features: Create response from an IOVEC and Thread-s

Subject: [libmicrohttpd] New Features: Create response from an IOVEC and Thread-safe Adding Connections to an EPoll Internal Thread MHD_Daemon
Date: Fri, 8 Jan 2021 17:14:01 +0000


We've made changes to libmicrohttpd that we'd like to see integrated into the 
project. If this isn't the appropriate forum for submitting patches please let 
us know.

I've attached the changes via three patch files, described below. All the 
developed by my colleague Lawrence Sebald who is CC'd. We initially made these 
changes to 0.9.62, and at the end of December ported them to 0.9.72. The 
patched 0.9.62 has been in our production environment for over a month and 
serviced billions of requests at this point. The patched version 0.9.72 is 
almost done testing and is to be pushed to production later this month.

Damon Earp

1. 0.9.72.patch 
    This contains all the changes that we've made to the library. I've included 
this as it is machine generated, the other patch files are a manual pruning of 
this file.

2. 0.9.72-MHD_create_response_from_iovec.patch
    Added the ability to give MHD a vector of distinct buffers which make up 
the response body. This allows a zero-copy for serving data that is fragmented 
in memory. This change further adds the `MHD_IOVContentReaderFreeCallback` type 
which includes a cls pointer on top of the iovec used to make the request. 

3. 0.9.72-internal_queue_connection.patch
    This is an ad hoc implementation to concurrently call 
`MHD_add_connection()` on a daemon with no listen socket and an epoll internal 
thread. We have been playing around with scheduling algorithms and have a pool 
of `MHD_Daemon` workers which we can schedule a connection to. Our initial 
attempts tried to rely on the locking in `internal_add_connection()` however we 
ran into too many race conditions that we created a linked list of queued 
connections in the daemon and then activated itc to drain the queue in the 
internal thread.

Attachment: 0.9.72-internal_queue_connection.patch
Description: 0.9.72-internal_queue_connection.patch

Attachment: 0.9.72-MHD_create_response_from_iovec.patch
Description: 0.9.72-MHD_create_response_from_iovec.patch

Attachment: 0.9.72.patch
Description: 0.9.72.patch

reply via email to

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