Commit Graph

54 Commits (fb3510b276053f2b00faddee5e3b306da7d58f4d)

Author SHA1 Message Date
Anthony Romano bd832e5b0a *: migrate Godeps to vendor/ 2016-03-22 17:10:28 -07:00
Xiang Li 5d256b7b86 rafthttp: pause peer should also pause its reader 2016-03-17 09:43:02 -07:00
Xiang Li e4f22cd6d8 rafthtt: smart batching
Improved the overall performance more than 20% under heavyload
with little latency impact

heavy load
```
Requests/sec: ~23200  vs  Requests/sec: ~31500

Latency distribution:
  10% in 0.0883 secs.
  25% in 0.1022 secs.
  50% in 0.1207 secs.
  75% in 0.1460 secs.
  90% in 0.1647 secs.
  95% in 0.1783 secs.
  99% in 0.2223 secs.

vs

Latency distribution:
  10% in 0.1119 secs.
  25% in 0.1272 secs.
  50% in 0.1469 secs.
  75% in 0.1626 secs.
  90% in 0.1765 secs.
  95% in 0.1863 secs.
  99% in 0.2276 secs.
```

Similar on light load too.
2016-02-17 13:17:12 -08:00
Xiang Li 74382f56fb rafthttp: handle short case in if statement 2016-02-16 19:26:51 -08:00
Xiang Li d393102e24 rafthttp: refactor 2016-02-16 19:21:53 -08:00
Xiang Li 11d3e9ac69 rafthttp: better comment for streamWriter 2016-02-16 19:21:06 -08:00
Anthony Romano fe7cfe4d3d rafthttp: plumb local peer URLs through transport 2016-02-05 16:44:41 -08:00
Anthony Romano db0b505de5 rafthttp: add requester to transport if peer does not exist
cluster integration now supports adding members with stopped nodes, too

Fixes #3699
2016-02-03 14:16:46 -08:00
siddontang 54a45ba2f5 *: fix typo 2016-01-06 16:17:02 +08:00
Gyu-Ho Lee 6aa559f93d rafthttp: more detailed logs when filled-up buffer
This adds more detailed explanation about why some messages got dropped to help
users debug. This is for https://github.com/coreos/etcd/issues/3806.
2015-11-18 14:17:43 -08:00
Yicheng Qin ec3c2d23a3 *: update feature maps to adopt v2.3.0 2015-11-04 14:30:35 -08:00
Yicheng Qin 65d153db73 Merge pull request #3783 from yichengq/merge-logger
rafthttp: use MergeLogger for rafthttp logging
2015-11-04 09:48:43 -08:00
Yicheng Qin 6040d57106 rafthttp: use MergeLogger to merge message-drop log
rafthttp logs repeated messages when amounts of message-drop logs
happen, and it becomes log spamming.
Use MergeLogger to merge log lines in this case.
2015-11-04 07:26:58 -08:00
Yicheng Qin 908a011604 rafthttp: mark unreachable on unexpected response
In rafthttp, when making request to some endpoint, it may receive
response with unexpected status code and header. This indicates the endpoint
doesn't function correctly. It should mark the endpoint unreachable.
2015-10-28 21:40:11 -07:00
Yicheng Qin 5060b2f322 rafthttp: send all MsgApp on stream msgAppV2
For stream msgAppV2, as long as the message is MsgApp type, it should be sent
through stream msgAppV2.
2015-10-20 08:23:36 -07:00
Yicheng Qin f725f6a552 rafthttp: deprecate streamTypeMsgApp
streamTypeMsgApp is only used in etcd 2.0. etcd 2.3 should not talk to
etcd 2.0, either send or receive requests. So I deprecate streamTypeMsgApp
and its related stuffs from rafthttp package.

updating term is only used from streamTypeMsgApp, so it is removed too.
2015-10-20 08:15:54 -07:00
Xiang Li 427a154aae rafthttp: various clean up 2015-10-18 09:49:18 -07:00
Yicheng Qin 6fc638673c rafthttp: return err if stopped before setting cancel in dial()
The original workflow may fail to cancel if stop() cancels the finished
request just before dial() assigning a new cancel. This commit checks
streamReader status before setting cancel to avoid this problem.

It is tested at travis for 300 times. go 1.5 always works well, while
go 1.4 fails to stop once.
2015-08-25 08:59:12 -07:00
Yicheng Qin fc95ec0cc6 rafthttp: always cancel in-flight request when stop streamReader
This problem is totally fixed at 1.5.

go1.5 adds a Request.Cancel channel, which allows for "race free"
cancellation
(8b4278ffb7).
Our implementation relies on it to always cancel in-flight request.
2015-08-25 08:54:13 -07:00
Xiang Li 6b23a8131f *: test gofmt with -s and fix reported issues 2015-08-21 18:52:16 -07:00
Yicheng Qin c9cca6a93b *: update MinClusterVersion and supportedStream map 2015-08-13 13:05:14 -07:00
Yicheng Qin fb4b0b5cf0 rafthttp: support to init term when adding peer
So it doesn't need to build term-0 stream with the remote first, then update it.
2015-06-29 10:20:48 -07:00
Yicheng Qin 2f05b24d6d rafthttp: {from, to} -> {local, remote} in stream
{from, to} nameings are confused when it both dials and receives
messages from the remote. Change it to {local, remote} for better
clarity.
2015-06-12 14:17:30 -07:00
Yicheng Qin bcc1aadea9 rafthttp: fix the misformat logging line
before:
```
2015/06/12 20:06:19 rafthttp: dropped MsgApp from %!s(uint64=2) since
receiving buffer is full
```

after:
```
2015/06/12 13:51:38 rafthttp: dropped MsgProp from 2 since receiving
buffer is full
```
2015-06-12 14:12:49 -07:00
Yicheng Qin 0de0e4b77c rafthttp: pretty print message drop info 2015-06-12 09:14:53 -07:00
Yicheng Qin 1dbe72bb74 rafthttp: pretty print connection error
1. print out the status change of connection with peer
2. only print the first error for repeated ones
2015-06-10 15:43:49 -07:00
Yicheng Qin f1e995b070 rafthttp: use leveled logger 2015-06-09 16:15:02 -07:00
Xiang Li 28878e34ff Merge pull request #2903 from xiang90/chord_rafthttp
rafhttp: clean up logging messages
2015-06-02 14:44:40 -07:00
Yicheng Qin c371d8c65c rafthttp: version enforcement on rafthttp messages
This PR sets etcd version and min cluster version in request header,
and let server check version compatibility. rafthttp server
will reject any message from peer with incompatible version(too low
version or too high version), and print out warning logs.
2015-06-02 13:33:18 -07:00
Xiang Li a7a4233f0b rafhttp: clean up logging messages 2015-06-01 17:18:37 -07:00
Xiang Li 0d3d4c5b01 rafthttp: print out log when clusterID mismatch instead of exiting
We have heard from several users that they do not expect a clusterID
mismatch to kill the cluster.
2015-05-26 16:05:58 -07:00
Yicheng Qin fad2c09fa8 rafthttp: not log expected timeout as error
The network timeout from stream with etcd 2.0 is expected because etcd
2.0 doesn't heartbeat on idle connections.
2015-05-26 14:52:41 -07:00
Yicheng Qin 38b8e848ac rafthttp: try stream msgappV1 handler if msgappV2 is unsupported
This helps etcd 2.1 connect to msgappV1 handler when the remote member
doesn't support msgappV2. And it doesn't print out unsupported handler
error to make log clean.
2015-05-26 14:52:41 -07:00
Yicheng Qin 2e43ac8463 rafthttp: add test for streamReader.updateMsgAppTerm 2015-05-15 11:21:54 -07:00
Yicheng Qin 8637a4bf69 rafthttp: only close streamMsgApp when updating term
In all stream types, streamMsgApp needs to be closed when
updating term because its stream connection can only be used under
a certain term. But there is no need to close other streams, which
may waste time and reduce performance.
2015-05-15 11:21:54 -07:00
Yicheng Qin 8e0992a28b rafthttp: resetCloser -> close
name 'close' is shorter and more straightforward.
2015-05-14 22:24:05 -07:00
Yicheng Qin fc4543a3fd Merge pull request #2628 from yichengq/improve-msgappv2
rafthttp: reduce allocs in msgappv2
2015-05-14 21:18:16 -07:00
Yicheng Qin 1c1cccd236 rafthttp: stop etcd if it is found removed when stream dial
The original process is stopping etcd only when pipeline message finds itself
has been removed. After this PR, stream dial has this functionality too.
It helps fast etcd stop, which doesn't need to wait for stream break to
fall back to pipeline, and wait for election timeout to send out message
to detect self removal.
2015-04-27 15:10:00 -07:00
Yicheng Qin 51548acb4f rafthttp: reduce allocs in msgappv2
The patch decreases the allocs when sending one AppEntry in msgappv2
stream from 30 to 9. This helps reduce CPU load when etcd is under
high write load.
2015-04-06 09:45:39 -07:00
Yicheng Qin 0d88e0d111 rafthttp: introduce msgappv2 stream format
msgappv2 stream is used to send all MsgApp, and replaces the
functionality of msgapp stream. Compared to v1, it has several
advantanges:
1. The output message is exactly the same with the input one, which
cannot be done in v1.
2. It uses one connection to stream persistently, which prevents message
reorder and saves the time to request stream.
3. It transmits 10 addiontional bytes in the procedure of committing one
proposal, which is trivia for idle time.
4. It transmits less bytes when committing mutliple proposals or keep
committing proposals.
2015-04-03 17:08:56 -07:00
Yicheng Qin e41cbeda5d rafthttp: drop messages in channel when disconnection
The messages in channel are outdated, and there is no need to send
them in the future. It also reports unreachable if there are messages
in the channel.
2015-03-11 14:42:06 -07:00
Yicheng Qin a230003255 rafthttp: report unreachable when dropping messages 2015-03-11 14:11:41 -07:00
Yicheng Qin 51397a6423 rafthttp: use go-routine for MsgProp processing
MsgProp process is blocking when there is no leader, which blocks the peer
loop totally.
2015-03-09 14:11:16 -07:00
Xiang Li 8e76ccf979 Merge pull request #2439 from xiang90/metrics
Metrics
2015-03-05 15:55:34 -08:00
Xiang Li a32abdbb0f rafthttp: make metrics naming consistent 2015-03-04 16:12:53 -08:00
Xiang Li ab33c068b7 rafthttp: record the number of failed messages 2015-03-04 16:09:50 -08:00
Yicheng Qin 0fe9861197 rafthttp: support multiple peer urls 2015-03-04 15:00:07 -08:00
Xiang Li 17aa3cf7db rafthttp: add metrics for sending message 2015-03-04 11:18:16 -08:00
Xiang Li 44e53953c9 rafthttp: add comments for Transporter interface 2015-03-03 22:34:47 -08:00
Yicheng Qin 8ec28f27d1 rafthttp: streamReader roundtrip -> dial 2015-03-02 13:26:48 -08:00