Commit Graph

132 Commits

Author SHA1 Message Date
Joris Vink 2fc5233358 Rework the way worker processes give each other the accept lock.
Instead of waiting until one worker is filled up on connections
the workers find the next lowest loaded worker and will hand
over the lock to them instead. This will cause a nicer spread of load.

Instead of running one accept per event loop, we attempt to accept
as many as worker_max_connections allows.

Refactor net sending/recv code a bit.
2013-06-27 00:22:48 +02:00
Joris Vink f707749cf4 no longer hold static openssl libs in the repo. 2013-06-26 19:05:54 +02:00
Joris Vink 124f3ecad9 no need to use kore_log() in a debug context 2013-06-26 15:59:42 +02:00
Joris Vink 113dbaba53 reset worker_max_connections back to default 2013-06-26 15:58:09 +02:00
Joris Vink bf1940225a everybody loves to tout their own horn.. so introduce a server response header 2013-06-26 16:58:01 +02:00
Joris Vink 7a2e855d28 set tstamp to 0 in the correct location 2013-06-26 16:57:34 +02:00
Joris Vink 0dda6f996f Add a form of synchronization between what worker will be accepting
new connections and which ones will not be notified for it.

Fixes the thundering herd problem, and nicely spreads out load between
all the workers equally. A configuration option (workers_max_connections)
is available to tweak how many connections a worker will have before
giving up the accept lock.

Two ways are added to this commit for access locking:
- Locking via semaphores.
- Locking via GCC's builtin atomic methods.

The default is running with semaphores disabled (OpenBSD cannot do
sem_init() with pshared set to 1, which is required).

If you want to use semaphores add KORE_USE_SEMAPHORES to CFLAGS,
and -lpthread to LDFLAGS in the Makefile.

Other fixes:
- BSD: add a timeout to kevent().
- Merge kore_worker_wait together, linux knows waitpid() as well.
- Send the correct SIGQUIT signal to workers instead of SIGINT.
- Fix kore_time_ms().
- Log fatal worker messages in syslog.
- Refactor code even more.
- Do not free our own kore_worker structure.
2013-06-26 16:37:22 +02:00
Joris Vink 315f964abd correct typo 2013-06-26 11:20:25 +02:00
Joris Vink 3e5c17b8a3 refactor code quite a bit. 2013-06-26 11:18:32 +02:00
Joris Vink cff44cd5f3 fix some broken things in the build script. 2013-06-25 08:26:06 +02:00
Joris Vink d2c4fde7fe fix so we can properly add binary media 2013-06-24 18:29:40 +02:00
Joris Vink f48fe0a326 remove unused 2013-06-24 18:23:29 +02:00
Joris Vink ae5da79f61 new build script for modules, which should be used as a base for
all new modules written by others.
2013-06-24 18:22:35 +02:00
Joris Vink c9f5bb82c9 i can't spell 2013-06-24 12:06:56 +02:00
Joris Vink e50ec64710 properly mention what license kore is 2013-06-24 12:05:22 +02:00
Joris Vink 427f65bb3d sync README 2013-06-24 11:53:33 +02:00
Joris Vink 6026a6d4ee add SNI support, and change domain configuration a bit. 2013-06-24 11:32:45 +02:00
Joris Vink a1b400c400 Add access logging to Kore. 2013-06-24 09:36:40 +02:00
Joris Vink 4dff38ebb0 ignore sigpipe in workers 2013-06-19 22:41:00 +02:00
Joris Vink c22eebb6d9 for non spdy clients, attempt to keep the connection open as long as possible (aka, send connection: keep-alive and do not close it till client does). 2013-06-22 20:14:10 +02:00
Joris Vink 9a9faa0d87 switching to github as master repo 2013-06-21 00:14:20 +02:00
Joris Vink aca6f75ff3 update readme 2013-06-21 00:07:35 +02:00
Joris Vink 8b832f0a37 fix off-by-one 2013-06-20 23:30:03 +02:00
Joris Vink c49622e4ae do not schedule kqueue events if we've reached the limit of changelist. 2013-06-20 23:29:26 +02:00
Joris Vink 25f1ab9865 Add BSD kqueue(2) support. Compile with make bsd (or make linux for linux) 2013-06-17 23:39:17 +02:00
Joris Vink 98de763632 s/light/kore 2013-06-17 23:54:59 +02:00
Joris Vink af3e57344b comment out non required lines 2013-06-15 16:16:51 +02:00
Joris Vink 920c2ad8b9 add link to maste repo 2013-06-05 16:57:24 +02:00
Joris Vink 6181cd7c8c even better 2013-06-05 16:42:39 +02:00
Joris Vink 463ea9c6f9 update README for github and split it up into docs/ 2013-06-05 16:41:42 +02:00
Joris Vink ead8af3b81 add TODO 2013-06-05 14:30:06 +02:00
Joris Vink 61605a99c4 update README 2013-06-05 14:10:29 +02:00
Joris Vink e170e916ce Reload the module in the main process as well when SIGHUP is received.
Otherwise new worker processes will not receive the updated module.
2013-06-05 13:50:50 +02:00
Joris Vink b4deea82b4 add kore_buf_appendb() which allows us to append a kore_buf to another one.
(releases the kore_buf that is being appended while at it).
2013-06-05 11:27:03 +02:00
Joris Vink a74fffe40c Introduce certfile and certkey in the configuration to specify where the certificate file and keys are located on a system.
Free unused vars in the main process after starting.
2013-06-05 09:47:08 +02:00
Joris Vink 32a2035ce9 move kore_server_sslstart() into main process, workers will inherit. 2013-06-05 09:32:53 +02:00
Joris Vink 72e09424af ergg spelling. 2013-06-05 09:30:04 +02:00
Joris Vink 36bf2d34c6 better example configuration. 2013-06-05 09:29:06 +02:00
Joris Vink 338047a95b use kore_log() to notify when a module is reloaded 2013-06-05 08:56:37 +02:00
Joris Vink b9f47b0f86 configuration files are now passed using the -c option.
allow debug output when the -d flag is specified.
2013-06-05 08:55:07 +02:00
Joris Vink ade34a26c1 move chroot() to workers instead, parent process doesn't require it plus it cannot unlink pidfile otherwise.
better logging in syslog
2013-06-05 08:45:51 +02:00
Joris Vink c9187041c4 update 2013-06-05 08:34:49 +02:00
Joris Vink 90e1b3a7da use syslog() for informative messages from all parts of kore. 2013-06-04 23:24:47 +02:00
Joris Vink 49b77d3b0e better proctitles 2013-06-04 17:04:28 +02:00
Joris Vink 276d8c5a82 oops bring back chroot 2013-06-04 17:01:06 +02:00
Joris Vink ca437a6cef set process title 2013-06-04 16:58:13 +02:00
Joris Vink 150bb8822f add pidfile to example configuration 2013-06-04 16:53:54 +02:00
Joris Vink 9ef669ff6f write main process pid to /var/run/kore.pid (changable in configuration) 2013-06-04 16:53:30 +02:00
Joris Vink 443b1c8c5f format 2013-06-04 16:33:35 +02:00
Joris Vink e7db5ee6b1 rename kore_log to kore_debug, and allow one to turn it off. 2013-06-04 16:30:53 +02:00