Commit Graph

413 Commits

Author SHA1 Message Date
nick
0a029fbbf5 bitset: Add an event stream implementation
Nothing is using it yet
2013-09-12 12:30:50 +01:00
nick
83426e1c01 tests: Update check_bitset to use new bitset_free() function 2013-09-11 16:09:27 +01:00
nick
86a000c717 bitset: Some whitespace changes 2013-09-11 15:48:19 +01:00
nick
54a41aacdf bitset: Add a bitset_free() function 2013-09-11 14:41:59 +01:00
nick
487bef1f40 flexnbd: Disconnect clients at the start of a mirror last pass
Currently, we prevent clients from processing requests by taking
the server I/O lock. This leads to requests hanging for a long
time before being terminated when the migration completes, which
is not ideal. With this change, at the start of the final pass,
existing clients are closed and any new connections will be closed
immediately (so no NBD server handshake will be seen).

This is part of the work required to remove remove the server I/O
lock completely.
2013-09-10 16:03:26 +01:00
nick
0494295705 mirror: Ensure the mirror client socket is closed after a fail, and before a retry 2013-08-27 15:54:59 +01:00
nick
14fde0f2a1 mirror: Remove overly-verbose log line 2013-08-21 14:41:19 +01:00
nick
e13d1d8fb4 mirror: honour max_bytes_per_second - naive scheme
If we're above max_bytes_per_second once we've finished a transfer
(8MB chunks, worst-case) then we delay the next transfer until
all_dirty_bytes / duration < max_bytes_per_second - checking once
per second.

If this isn't good enough, we can improve it - leaky bucket is one
option. To begin with, though, we'll mostly be using this to set
max_bps to either 0 or 100MB/sec or so. So it should be fine.
2013-08-14 16:24:50 +01:00
nick
efdd613968 listen: Turn off CLIENT_MAX_WAIT_SECS
The idea behind this feature was to avoid the client thread in a listen
server getting stuck forever if the mirroring thread in the source died.
However, it breaks any sane implementation of max_Bps in that thread,
and there are lingering concerns over how it might operate under normal
conditions anyway.

Specifically, if iterating over the bitmap takes a long time, or even just
reading the requisite 8MB from the disc in order to send it, then the
5-second timeout could be hit, causing mirroring to fail unnecessarily.
2013-08-14 16:09:55 +01:00
nick
d0022402ae mirror: Start our timeout watcher from the first, not second, transfer 2013-08-14 15:29:24 +01:00
nick
28fff91af1 flexnbd: add a mirror-speed command to change mirror->max_bytes_per_second
It's not actually honoured yet, and ideally, you'd also be able to set it as
part of the initial setup: "flexnbd mirror ... -m 4G". remote_argv for the
mirror case would need to become x=y z=w format first, though.
2013-08-14 13:33:02 +01:00
nick
385c9027db flexnbd status: display mirror->max_bytes_per_second as mirror_speed_limit 2013-08-14 13:30:25 +01:00
nick
b73081e417 One more fix 2013-08-13 16:22:44 +01:00
nick
cc468b0b17 control/mirror: Use uint64_t and strtoull to get max_Bps into the mirror 2013-08-13 12:30:18 +01:00
nick
7128fcc901 control: Output abandoned mirror state 2013-08-13 12:29:53 +01:00
nick
45355666f7 mirror: And another abandon fix 2013-08-12 16:14:53 +01:00
nick
8a294e5ee0 mirror: fix abandon 2013-08-12 15:54:49 +01:00
nick
c6764b0de1 mirror: abandon signals are now honoured outside of the remote end being readable / writable 2013-08-12 15:30:21 +01:00
nick
41facd2ccf Branch merge 2013-08-09 17:07:06 +01:00
nick
f6456349f7 Backed out changeset e58ff57b5e2d
Slows tests down
2013-08-09 17:06:56 +01:00
nick
9f4fbe782c Branch merge 2013-08-09 17:03:25 +01:00
nick
8c750a5e9d listen: Allow longer gaps between transfers 2013-08-09 17:02:58 +01:00
nick
64702d992d Minor fixes here and there 2013-08-09 17:02:33 +01:00
nick
c2df38c9d3 mirror: Use libev to provide an event loop inside the mirror thread
We're doing this so we can implement bandwidth controls sanely.
2013-08-09 17:02:10 +01:00
nick
754949d43f bitset: Add a bitset_run_count_ex that lets you learn the value of the bits in the run 2013-08-09 16:49:38 +01:00
lupine
1a966ca0be bitset: Prove that bitset operations with len=0 don't underflow 2013-07-26 17:09:21 +01:00
nick
f590f8ed3c status: Add migration_speed ( bytes per second ) and migration_duration( seconds ) to the migration output 2013-07-26 11:50:01 +01:00
nick
bc9ce93648 bitset: squash one more bug 2013-07-25 10:58:50 +01:00
nick
a5870b8e9b Remove a stray debugging statement 2013-07-25 10:14:14 +01:00
nick
bed8959d47 bitset: Fix large runs 2013-07-24 17:42:08 +01:00
nick
5c59a412af flexnbd-proxy: ensure upstream cooldown is applied when read init from upstream fails 2013-07-24 16:01:38 +01:00
nick
253cee5a10 flexnbd: Acknowledge new return type of bitset_run_count 2013-07-24 15:08:29 +01:00
nick
7de22a385e flexnbd: clients should be MADV_RANDOM, rather than MADV_SEQUENTIAL 2013-07-24 14:18:23 +01:00
nick
14db3315ca non-debug builds get -O2 for impressive bitset speedups 2013-07-24 12:34:36 +01:00
nick
efe9eaef7c bitset: A more-efficient bit(set)_run_count 2013-07-24 12:03:24 +01:00
nick
f8fd4e0437 bitset: Actually enable an optimization in bit_set/clear_range
Previously, we were setting bits up to the first byte boundary,
memset()ing to the last byte boundary, then ignoring the memset()
and resetting every single bit up to the last one individually,
from where the first for-loop left off.

This should be *at least* nine times faster.
2013-07-24 11:19:52 +01:00
nick
9a37951aaa bitset: Use uint64_t everywhere to avoid possible integer overflows
Hasn't been a problem in practice, mind.
2013-07-24 10:34:22 +01:00
nick
d18423c153 tests: Fix a couple of compile warnings 2013-07-23 17:22:23 +01:00
nick
1b0fe24529 test: Add some tests for bitset_run_count 2013-07-23 17:13:40 +01:00
nick
5c5636b053 flexnbd mirror: If the final run would be longer than the file size, truncate to file size
This fixes migrations of images that are not exactly divisible by 4096
2013-07-23 11:00:51 +01:00
nick
afe76debf7 flexnbd status: Actually output pass statistics 2013-07-08 14:27:04 +01:00
nick
f4bfc70a4b flexnbd status: Add current pass clean/dirty byte statistics 2013-07-08 13:51:15 +01:00
nick
b29ef6d4de flexnbd status: Avoid a possible NULL dereference reading migration status
While the mirror mutex is taken, the mirroring can be abandoned and serve->mirror
set to NULL, so we need to lock around reading information from serve->mirror
2013-07-08 13:32:14 +01:00
nick
dee0bb27d6 flexnbd status: Add the size of the backing file, in bytes
This will be handy information if you're querying flexnbd for migration
stats, particularly.
2013-07-08 10:11:18 +01:00
nick
f556f298b1 flexnbd status: Add current migration pass to the status output if we're migrating 2013-07-08 09:58:31 +01:00
nick
55b452ebef Fix tests for new killswitch argument 2013-07-03 10:04:08 +01:00
nick
9f34752842 flexnbd: Make the killswitch runtime-selectable
We're not actually using it in production right now because it doesn't
shut its sockets down cleanly enough. This is a better option than
reverting the functionality or keeping production downgraded until
we sort out a handler that cleanly closes the sockets.
2013-07-03 09:56:35 +01:00
nick
81d41f567d proxy: Reduce the reconnect cooldown from 15 seconds to 3.
Exponential backoff would be better, but that's OK
2013-06-20 10:26:34 +01:00
nick
89fd18f6f0 proxy: Add a 30-second timeout for requests in-flight to upstream
It's a little more complicated than that, actually. For the various
states that involve reading from, or writing to, the upstream fd,
if the amount of time spent in that state is > 30 seconds, we reconnect
to the server and resend the request.

we also introduce a 15-second reconnect dampener to keep us from stressing
things unduly. This may need to be decreased, or turned into an exponential
backoff, at some point.
2013-06-19 16:36:19 +01:00
nick
3c56ba0af6 proxy: Fix a comment 2013-06-19 11:27:09 +01:00