kore/examples
Joris Vink dd2dff2318 Rework HTTP and worker processes.
The HTTP layer used to make a copy of each incoming header and its
value for a request. Stop doing that and make HTTP headers zero-copy
all across the board.

This change comes with some api function changes, notably the
http_request_header() function which now takes a const char ** rather
than a char ** out pointer.

This commit also constifies several members of http_request, beware.

Additional rework how the worker processes deal with the accept lock.

Before:
	if a worker held the accept lock and it accepted a new connection
	it would release the lock for others and back off for 500ms before
	attempting to grab the lock again.

	This approach worked but under high load this starts becoming obvious.

Now:
	- workers not holding the accept lock and not having any connections
	  will wait less long before returning from kore_platform_event_wait().

	- workers not holding the accept lock will no longer blindly wait
	  an arbitrary amount in kore_platform_event_wait() but will look
	  at how long until the next lock grab is and base their timeout
	  on that.

	- if a worker its next_lock timeout is up and failed to grab the
	  lock it will try again in half the time again.

	- the worker process holding the lock will when releasing the lock
	  double check if it still has space for newer connections, if it does
	  it will keep the lock until it is full. This prevents the lock from
	  bouncing between several non busy worker processes all the time.

Additional fixes:

- Reduce the number of times we check the timeout list, only do it twice
  per second rather then every event tick.
- Fix solo worker count for TLS (we actually hold two processes, not one).
- Make sure we don't accidentally miscalculate the idle time causing new
  connections under heavy load to instantly drop.
- Swap from gettimeofday() to clock_gettime() now that MacOS caught up.
2018-02-14 13:48:49 +01:00
..
cookies change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00
cpp change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00
generic change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00
headers Rework HTTP and worker processes. 2018-02-14 13:48:49 +01:00
integers Allow param blocks to be marked as "querystring" 2018-01-16 18:47:50 +01:00
json_yajl 2018 2018-01-20 22:51:06 +01:00
jsonrpc change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00
ktunnel Allow param blocks to be marked as "querystring" 2018-01-16 18:47:50 +01:00
memtag 2018 2018-01-20 22:51:06 +01:00
messaging change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00
nohttp change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00
parameters Allow param blocks to be marked as "querystring" 2018-01-16 18:47:50 +01:00
pgsql 2018 2018-01-20 22:51:06 +01:00
pgsql-sync change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00
pipe_task change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00
python 2018 2018-01-20 22:51:06 +01:00
python-pgsql 2018 2018-01-20 22:51:06 +01:00
sse Rework HTTP and worker processes. 2018-02-14 13:48:49 +01:00
tasks Rework HTTP and worker processes. 2018-02-14 13:48:49 +01:00
tls-proxy change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00
upload 2018 2018-01-20 22:51:06 +01:00
video_stream Rework HTTP and worker processes. 2018-02-14 13:48:49 +01:00
websocket change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00