Commit Graph

361 Commits

Author SHA1 Message Date
Derek Collison
d09b6bdcf7 Optimize last activity and revert queue performance to alleviate normal sub performance hit 2016-03-07 06:24:23 +00:00
Derek Collison
49a7f2295a gofmt -s fixes 2016-02-29 22:08:49 -08:00
Ivan Kozlovic
3ea412798a Optimizations
-No need to store ip url string in c.route and resolve remote IP
 when forwarding the INFO to known servers.
-When checking if a route is explicit, use strings.ToLower() once
 for the url being checked.
2016-02-25 20:00:21 -07:00
Ivan Kozlovic
7c0a3b49a6 Fix cluster formation when servers connect quickly
Both seed and chained cases are now handled properly when servers
connect quickly and concurrently to one another.
When accepting a route, the server will forward the new route INFO
protocol to its known routes. In turn those routes will connect
to the new server (if not already connected).
A retry for implicit route was introduced to mitigate the issue
with two servers connecting to each other and electing the opposite
connection as the winner, resulting in both connections being dropped.
The server with smaller ID will try once to reconnect.
Some tests were fixed to handle possible extra INFO protocol.
New tests added.

Fix issue: https://github.com/nats-io/gnatsd/issues/206
2016-02-24 19:44:25 -07:00
Derek Collison
7a7cbfa80b Merge pull request #214 from nats-io/nuid
nuid
2016-02-24 10:33:14 -08:00
Derek Collison
b34d6eac1e ID prefix, print debug server ID on startup, bumped version 2016-02-24 09:38:28 -08:00
Derek Collison
8e5f925b87 Bumped version for nuid 2016-02-24 09:23:10 -08:00
Derek Collison
81ae341c2c Use nuid for ID generation 2016-02-24 09:22:38 -08:00
Ivan Kozlovic
7becd0ceeb Fix ports for cluster bcrypt auth config files in server package
The ports were conflicting with the 'test' package when running
the test suite in parallel (go test -race -v ./...)
2016-02-23 21:32:48 -07:00
Derek Collison
7237972420 support for bcrypt in cluster auth 2016-02-23 12:47:46 -08:00
Waldemar Quevedo
7ac3eae82e Set IP and Port for connections using TLS in /connz 2016-02-15 17:40:13 -08:00
Derek Collison
1f143a7b3e beta tag was being overloaded with lots of changes, so bumped 2016-02-11 16:40:22 -08:00
Ivan Kozlovic
ce79f524be Fix scheme for routes returned
When server returns routes through INFO, use "nats-route://" scheme.
A test was checking that.
Add test to check that hostname is replaced with IP.
2016-02-11 17:20:33 -07:00
Ivan Kozlovic
fc38a8336f Fix wrong check for error 2016-02-11 13:29:34 -07:00
Ivan Kozlovic
cef87212b9 Fix route url to use remote IP instead of configured url when sending in INFO protocol. 2016-02-11 11:23:41 -07:00
Ivan Kozlovic
112413a466 Fix infinite server attempt to connect route to itself
Attempt to address issue #175.
Instead of trying to detect if route URL will point to route listen address, detects that the route remoteID is server's ID.
If so, closes the connection and stop trying.
2016-02-10 14:19:54 -07:00
Ivan Kozlovic
193597dbab Update test that would catch incorrect NumConns
- Updating TestConnzWithOffsetAndLimit() to test for c.NumConns.
This would have caught the issue that was fixed in my previous change.

- Use of variable sortValue set to pair.Val to help readability. No functional change.
2016-02-09 12:40:20 -07:00
Ivan Kozlovic
e5f0dabe08 Reduce memory allocations + fix c.NumConns that may have been wrong.
c.NumConns was set early to len(s.clients). However, after the sort, it was possible that the actual Conns[] array be much smaller due to minoff/maxoff.
So c.NumConns is now updated only after applying the offsets.
In order to pre-allocate the Conns buffer, I no longer skip a client if tlsRequired is true and connection is gone. I will simply not update the TLSVersion and TLSCipher.
2016-02-08 20:46:22 -07:00
Ivan Kozlovic
08b8dd796a Fix test to check Idle instead of relying on client id.
Since client connections are handled in go routines, we don't have a guarantee that the second client's id will be > than the first.
2016-02-08 15:51:41 -07:00
Ivan Kozlovic
ecec51a771 Reduce number of objects require to sort connection in HandleConnz
- Use 'Pair' again, but this time, the key is an int64 that the selected sort field will be casted to.
We therefore have now only one type of sort.
- Check validity of sort string early on.
- Ensure that the ConnInfo's field used by the sort is not the value from 'client', but really the one
that was used for the sort.
- Added a test for sort by Idle time.
2016-02-08 15:40:42 -07:00
Ivan Kozlovic
b6292d6d6d Fix monitor port usage for parallel tests.
Use a different MONITOR_PORT for different test packages.
2016-02-08 09:33:39 -07:00
Ivan Kozlovic
945fb0997a Fix missing return after Fatalf() calls.
Due to clash on monitor ports, running parallel tests could cause failure to create monitor listener. The missing return would then cause a nil pointer error when starting to server http requests.
2016-02-08 09:30:44 -07:00
Derek Collison
d7c8e6bca8 Fix races in monitoring
- Possible race/invalid value in LastActivity
- Routez
- Believe fixes #189
2016-02-06 07:09:13 -08:00
Derek Collison
853b4d720b Randomize distribution to subscribers
Better performance for queue subscriber distribution.
2016-02-05 09:06:17 -08:00
Derek Collison
c0ba6c291f Default sort by cid for connz 2016-02-05 06:07:44 -08:00
Derek Collison
703f928a4d Fix race on last activity 2016-02-05 05:58:09 -08:00
Derek Collison
9702156d72 Connection sort updates
- fix bug that did not update last activity on message delivery
- added sort capabilities for last activity
- avoid extra Reverse by simply changing Less func
2016-02-05 05:49:53 -08:00
Derek Collison
b4a6547a18 report len(ci.subs) 2016-02-04 18:05:50 -08:00
Derek Collison
26185a9722 Support for connection last activity tracking 2016-02-04 17:33:40 -08:00
Ivan Kozlovic
0540df470c Use values from ClientInfo instead of client when returning ConnInfo.
When we are returning ConnInfo, if we use the client's current value, they may be off compared to the values used for the sort.
2016-02-03 22:03:38 -07:00
Ivan Kozlovic
e893d873be Forgot to use atomic for inMsgs and inBytes in one place. 2016-02-03 21:36:07 -07:00
Ivan Kozlovic
1d6dafc6a7 Fix race on connz monitor (issue #189) 2016-02-03 21:26:26 -07:00
Derek Collison
02dc7ed668 Merge pull request #186 from wallyqs/unsub-spc-state
Add UNSUB_SPC parser state
2016-02-03 18:53:36 -08:00
Ivan Kozlovic
eb0eabff04 Replace all changes with simple 25ms delay after connection close. 2016-02-03 18:58:42 -07:00
Ivan Kozlovic
437458e13e Fix completeConnection + fix monitor test.
Don't check what is sent back. The point is that the client should be fully initialized at this point.
We can't ensure using metrics that the "check" connection is gone since in some tests, the server is started and clients auto-reconnect to it.
For tests that depend on the number of clients connected (such as the monitor one), have specific code for those tests.
2016-02-03 18:08:52 -07:00
Ivan Kozlovic
0a4da78f38 Fix code that checks that server is started + route test
- The raw connection used to check that the server is started now consumes the INFO and sends PING and consumes PONG before returning.
- The route test needs to make sure that the client connection has client id 2. Using PING/PONG before creating route connection to make sure of that.
2016-02-03 15:01:00 -07:00
Waldemar Quevedo
86824713c6 Add UNSUB_SPC parser state 2016-02-02 21:39:30 -08:00
Larry McQueary
e737604303 Modified --auth to reflect required token 2016-02-02 15:11:48 -07:00
Larry McQueary
6396455663 Add 'auth' option, make all usage hints uniform with conventions 2016-02-02 11:50:01 -07:00
Derek Collison
59a52ed83a Documentation updates, minor fixes 2016-01-10 09:14:26 -08:00
Derek Collison
6433e55314 bad test conditional 2016-01-09 10:09:05 -08:00
Derek Collison
6bd8f5fd70 inlined roothtml 2016-01-09 10:04:42 -08:00
Derek Collison
3af90e454f Track total connections, http request stats 2016-01-09 09:57:04 -08:00
Derek Collison
b0c22e9dfd Track start and uptime per connection 2016-01-09 08:20:24 -08:00
Derek Collison
1e37a6b23c Monitoring homepage updates, help and favico 2016-01-09 07:57:58 -08:00
Derek Collison
e9b5839bf0 Merge branch 'discovery' 2015-12-16 14:18:34 -08:00
Derek Collison
8393c3c994 Basic INFO for cluster auto-discovery, Addresses #126 2015-12-16 12:36:24 -08:00
Ivan Kozlovic
b060eb3d5f Ensure server lock is released in case of failure when resolving port back to options. 2015-12-10 14:11:37 -07:00
Ivan Kozlovic
d133e68338 Adapt tests for Travis GCE.
* Add server.GetListenEndpoint() to return options' host and port when server is ready to accept client connections. The server can be asked to pick a random port. This function returns a string of the form "host:port" with the port selected by the net.Listen() call.
* Replace the use of server.Addr() with above function to connect to the starting server (using net.Dial) to check for success. The original issue was that, when no hostname is specified in the configuration, the server uses 0.0.0.0 for the listen address. However, server.Addr() would return "[::]", even on a machine with IPv6 disabled, which would cause the net.Dial call to fail with "network unreachable".
2015-12-10 13:06:18 -07:00
Derek Collison
7046d54881 Release 0.7.2 2015-12-09 11:23:37 -08:00