Commit Graph

712 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
Derek Collison
d63b7eadcf spelling 2016-02-29 21:56:14 -08:00
Derek Collison
7a13d68bd3 Merge pull request #215 from nats-io/fix_route_discovery
Fix cluster formation when servers connect quickly
2016-02-29 10:58:27 -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
Derek Collison
06174b6a0d Merge pull request #213 from nats-io/cluster_bcrypt_configs
Fix ports for cluster bcrypt auth config files in server package
2016-02-23 22:35:34 -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
cba523ba86 Merge pull request #212 from nats-io/cluster_auth_bcrypt
Support for bcrypt in cluster auth
2016-02-23 12:53:17 -08:00
Derek Collison
7237972420 support for bcrypt in cluster auth 2016-02-23 12:47:46 -08:00
Derek Collison
db5f42d54e Merge pull request #207 from wallyqs/connz-tls-ip-port
Set IP and Port for monitoring connections using TLS in /connz
2016-02-15 22:16:45 -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
9fac37dd66 bad auth error test 2016-02-13 18:48:05 -08:00
Derek Collison
1f143a7b3e beta tag was being overloaded with lots of changes, so bumped 2016-02-11 16:40:22 -08:00
Derek Collison
4d3d070b35 Merge pull request #203 from nats-io/fix_route_ip
Return route's remote IP through INFO protocol
2016-02-11 16:38: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
Derek Collison
50988b7411 Merge pull request #202 from nats-io/detect_route_to_self
Fix infinite server attempt to connect route to itself
2016-02-10 22:37:43 -08: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
Derek Collison
d77f416140 Merge pull request #201 from nats-io/update_connz_test
Update test that would catch incorrect NumConns
2016-02-09 11:55:58 -08: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
Derek Collison
416af2525c Merge pull request #199 from nats-io/connz_changes
Reduce number of objects needed to sort connections in HandleConnz
2016-02-08 21:47:03 -08: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
Derek Collison
d22b52b20e Merge pull request #198 from nats-io/fix_parallel_monitor_tests
Fix parallel monitor tests
2016-02-08 12:18:14 -08: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
1a06713304 Merge pull request #197 from nats-io/monitor_race
Fix races in monitoring
2016-02-06 07:46:09 -08:00
Derek Collison
1d5f4c3373 For possible slow travis tests 2016-02-06 07:41:37 -08:00
Derek Collison
a8f622269b For possible slow travis tests 2016-02-06 07:35:09 -08: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
ddda4abbda Merge pull request #196 from nats-io/queue_subs
Randomize distribution to subscribers
2016-02-05 09:18:20 -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
809f88a03a subs could be random 2016-02-05 08:32:11 -08:00
Derek Collison
907c226849 remove alloc tracking 2016-02-05 07:50:19 -08:00
Derek Collison
2fcdebc34d formatting 2016-02-05 07:36:48 -08:00
Derek Collison
661238eb1a Add 8 subscriber queue benchmark 2016-02-05 07:34:21 -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
5e73ebb622 Merge pull request #191 from nats-io/last_activity
Support for connection last activity tracking.
2016-02-04 17:58:29 -08:00
Derek Collison
26185a9722 Support for connection last activity tracking 2016-02-04 17:33:40 -08:00
Derek Collison
6b4f6f20ee Merge pull request #190 from nats-io/fix_race_monitor
Fix race on connz monitor (issue #189)
2016-02-03 22:10:48 -08:00