Commit graph

469 commits

Author SHA1 Message Date
Paul Saab
3f5b6b55b0 Limit number of concurrent connections
Go's net/http library has no limits in place for number of concurrent
requests currently being processed.  This can result in an enormous
number of goroutines being created and the read/write buffer pools
growing unbounded resulting in OOM situations.
2014-09-25 10:58:07 -07:00
Jimmy Zelinskie
ec71e28fdc Merge pull request #31 from psaab/develop
Introduce TorrentSize stat and replace some locks in PeerMap with atomic increments.
2014-09-24 19:33:30 -04:00
Paul Saab
2b8dec07fe Use atomics to track peermap size 2014-09-24 16:24:36 -07:00
Paul Saab
47613d4bbd Track the total size of the of the torrents map 2014-09-24 16:24:14 -07:00
Paul Saab
f74ef67d08 Only decrement torrent map size if hash exists 2014-09-24 16:22:14 -07:00
Justin Li
9fea8195bb Merge pull request #30 from psaab/develop
Reduce contention on the torrent map
2014-09-24 15:42:29 -04:00
Paul Saab
ad9034da6d Reduce contention on the torrent map
We see the torrent map have quite a bit of contention.  Shard the map by
a configurable number of shards to reduce the times we may contend on
the lock.
2014-09-24 10:23:16 -07:00
Jimmy Zelinskie
b910fdabf5 Organize peers by subnet.
This commit restructures PeerMaps to be a map from Subnet to
PeerID to Peer. This reduces the complexity require to gather peers from
the same subnet.
2014-09-23 23:00:50 -04:00
Jimmy Zelinskie
6a96245d90 AppendPeers now uses readlock. 2014-09-15 22:14:27 -04:00
Justin Li
976a983aa7 go fmt [ci skip] 2014-09-03 10:18:26 -04:00
Cooper Lees
67df033c7f Add configurable HTTP read and write timeouts 2014-09-02 22:24:15 -07:00
Jimmy Zelinskie
0f0296be1e Address missing copyright on storage.go [ci skip] 2014-09-03 00:57:11 -04:00
Jimmy Zelinskie
f001489294 Unlock torrent mutex when continuing purge loop. 2014-09-03 00:52:21 -04:00
Jimmy Zelinskie
417d2a3b12 Disable HTTP KeepAlives 2014-08-26 18:03:44 -04:00
Cooper Lees
26de6d2e9c Respect a clients AF Optional Support - config driven 2014-08-21 07:11:35 -07:00
Jimmy Zelinskie
1d9b2bc322 First step towards removing Tracker Driver.
This feature isn't worth maintaining and if anyone needs to scale beyond
memory on a single box, we can evaluate it then.
2014-08-13 17:45:34 -04:00
Jimmy Zelinskie
e3420b4013 Silence net.OpErrors dealing with accept.
This code is borrowed from:
6e11439113/graceful.go (L52-L58)
2014-08-05 15:00:52 -04:00
Jimmy Zelinskie
fc18028796 Fix Purge reporting all peers as Seeders
PeerMaps now are constructed with a boolean value that tells the map
whether they are hosting seeders or leechers.
2014-08-05 06:57:48 -04:00
Jimmy Zelinskie
01fa778ce2 JSON Encoding for PeerMaps 2014-08-04 07:05:13 -04:00
Jimmy Zelinskie
9e45f77efe Create peermap.go, add documentation 2014-08-04 06:37:31 -04:00
Jimmy Zelinskie
3cb286fb40 Introduce thread-safe PeerMap 2014-08-04 06:15:08 -04:00
Justin Li
d610b4ebb0 Address easy golint comments 2014-08-01 16:16:38 -04:00
Justin Li
a55219963b Prevent unsigned overflow from breaking stats 2014-08-01 16:11:34 -04:00
Justin Li
ac61c7880d Record raw upload/download 2014-08-01 16:07:10 -04:00
Jimmy Zelinskie
8051e0e22e Calculate delta based off of old peer 2014-08-01 15:51:26 -04:00
Jimmy Zelinskie
5622a3ded2 Only calculate delta if tracker is private 2014-08-01 15:19:27 -04:00
Jimmy Zelinskie
f747a79c8c Calculate up/down delta before altering peer 2014-08-01 15:11:37 -04:00
Justin Li
f48e1e452f Don't write to the peer maps in the announce code 2014-08-01 14:09:29 -04:00
Justin Li
2a12685007 Don't consider errored snatches to be snatches 2014-08-01 13:46:14 -04:00
Justin Li
6f514cbad5 Fix snatched logic to read seeder list before updating it
Refactor more
2014-08-01 13:35:35 -04:00
Justin Li
14fd5612af Remove user snatches (should be handled by backend) 2014-08-01 13:25:30 -04:00
Justin Li
24b4437edd Initial refactor to store more in the Announce 2014-08-01 13:24:24 -04:00
Justin Li
bfd8e110ea Add a comment explaining why Peer.IP is unambiguous 2014-08-01 12:50:24 -04:00
Justin Li
b628b934ac Only keep one IP in the Peer type 2014-08-01 12:37:35 -04:00
Justin Li
dfeda26c16 Extract percentile implementation 2014-08-01 11:52:45 -04:00
Justin Li
dda56c4357 Add missing copyright headers 2014-08-01 11:52:45 -04:00
Jimmy Zelinskie
e52e4d5f1d Introduce PeerKey
PeerKeys are used to prevent overwriting of peers which want to announce
for both IPv4 and IPv6.
2014-08-01 11:21:57 -04:00
Jimmy Zelinskie
c438b877ba add error checking to loading whitelist 2014-07-26 06:15:40 -04:00
Jimmy Zelinskie
ffb3c57181 move whitelist into cfg 2014-07-25 16:58:26 -04:00
Justin Li
cde8251bd3 Add logging for startup failure 2014-07-25 03:43:06 -04:00
Justin Li
3b84fb3f98 Better logging 2014-07-25 03:39:02 -04:00
Justin Li
404270b0ae Disable whitelist by default 2014-07-25 03:38:50 -04:00
Justin Li
818bef28d7 More refactoring of error handling 2014-07-25 03:05:43 -04:00
Justin Li
683e90631a Add pretty stats param and refactor error handling 2014-07-25 03:01:26 -04:00
Justin Li
9a79693a4c Verbose mem stats are way too verbose to be a default
[ci skip]
2014-07-25 02:18:14 -04:00
Justin Li
36251afd67 Fix typo in example config and keep default values consistent
[ci skip]
2014-07-25 02:13:09 -04:00
Jimmy Zelinskie
64d08ca16b add whitelist flag 2014-07-25 01:48:30 -04:00
Jimmy Zelinskie
941de3d12e goimports 2014-07-25 01:46:58 -04:00
Jimmy Zelinskie
200bf30db3 refresh example config 2014-07-25 01:39:03 -04:00
Justin Li
38209e2301 Update references to FlatMap
[ci skip]
2014-07-25 00:47:29 -04:00