Go to file
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
conf Allow param blocks to be marked as "querystring" 2018-01-16 18:47:50 +01:00
examples Rework HTTP and worker processes. 2018-02-14 13:48:49 +01:00
includes Rework HTTP and worker processes. 2018-02-14 13:48:49 +01:00
kodev no need for -rdynamic in kodev. 2017-02-22 13:01:53 -08:00
src Rework HTTP and worker processes. 2018-02-14 13:48:49 +01:00
.gitignore Ignored .lvimrc and prior vim stale files if there 2016-07-09 12:27:01 +02:00
.travis.yml Updated .travis.yml to use new container-based infrastructure. 2015-10-18 14:26:44 +02:00
LICENSE update copyright year 2017-01-18 10:27:40 +01:00
Makefile Rework HTTP and worker processes. 2018-02-14 13:48:49 +01:00
README.md Rework HTTP and worker processes. 2018-02-14 13:48:49 +01:00

README.md

About

Build Status

Kore (https://kore.io) is an easy to use web application platform for writing scalable web APIs in C. Its main goals are security, scalability and allowing rapid development and deployment of such APIs.

Because of this Kore is an ideal candidate for building robust, scalable and secure web things.

Key Features

  • Supports SNI
  • Supports HTTP/1.1
  • Websocket support
  • Privseps by default
  • TLS enabled by default
  • Optional background tasks
  • Built-in parameter validation
  • Optional asynchronous PostgreSQL support
  • Optional support for page handlers in Python
  • Private keys isolated in separate process (RSA and ECDSA)
  • Default sane TLS ciphersuites (PFS in all major browsers)
  • Modules can be reloaded on-the-fly, even while serving content
  • Event driven (epoll/kqueue) architecture with per CPU worker processes
  • Build your web application as a precompiled dynamic library or single binary

And loads more.

License

  • Kore is licensed under the ISC license

Documentation

Read the documentation This documentation is severly outdated at this time.

Platforms supported

  • Linux
  • OpenBSD
  • FreeBSD
  • MacOS

Building Kore

Grab the latest release tarball or clone the repository.

Requirements

  • openssl (1.0.2k+ or 1.1.0e+) (note: this requirement drops away when building with NOTLS=1 NOHTTP=1) (note: libressl should work as a replacement)

Requirements for background tasks (optional)

  • pthreads

Requirements for pgsql (optional)

  • libpq

Requirements for python (optional)

  • Python 3.6+

Normal compilation and installation:

$ cd kore
$ make
# make install

If you would like to build a specific flavor, you can enable those by setting a shell environment variable before running make.

  • TASKS=1 (compiles in task support)
  • PGSQL=1 (compiles in pgsql support)
  • DEBUG=1 (enables use of -d for debug)
  • NOTLS=1 (compiles Kore without TLS)
  • NOHTTP=1 (compiles Kore without HTTP support)
  • NOOPT=1 (disable compiler optimizations)
  • JSONRPC=1 (compiles in JSONRPC support)
  • PYTHON=1 (compiles in the Python support)

Note that certain build flavors cannot be mixed together and you will just be met with compilation errors.

Example applications

You can find example applications under examples/.

The examples contain a README file with instructions on how to build or use them.

Bugs, contributions and more

If you run into any bugs, have suggestions or patches please contact me at joris@coders.se.

More information can be found on https://kore.io/