skydb/sky — pull request #118 by boourns (2013-08-19 01:08:31+00:00)
Title: Batch insert events

@benbjohnson please review

This speeds up bulk event insertion, especially in the case where many separate processes are sending PATCH events to skydb in parallel.

The problem was that sky's logic was:
```
for each event
find table
lock relevant servlet
put event
unlock relevant servlet
```

This PR flips that to:
```
find table
group all events by servlet
for each servlet
lock
put all events
unlock
```

This exponentially decreases lock count and table lookups per batch write. On my laptop this speeds things up by ~20% or so with 3 threads writing simultaneously to skydb.

It also writes the event count written back to the user on successful batch write.

I have 3 test fails I'm uncertain about, and for me on `unstable` the OpenTest already fails. I'll clean those up and anything other feedback you have.