{"action":"closed","issue":{"url":"https://api.github.com/repos/distributed-system-analysis/pbench/issues/375","repository_url":"https://api.github.com/repos/distributed-system-analysis/pbench","labels_url":"https://api.github.com/repos/distributed-system-analysis/pbench/issues/375/labels{/name}","comments_url":"https://api.github.com/repos/distributed-system-analysis/pbench/issues/375/comments","events_url":"https://api.github.com/repos/distributed-system-analysis/pbench/issues/375/events","html_url":"https://github.com/distributed-system-analysis/pbench/issues/375","id":176059781,"number":375,"title":"pbench-uperf port number usage leads to lack of scalability","user":{"login":"bengland2","id":1717107,"avatar_url":"https://avatars.githubusercontent.com/u/1717107?v=3","gravatar_id":"","url":"https://api.github.com/users/bengland2","html_url":"https://github.com/bengland2","followers_url":"https://api.github.com/users/bengland2/followers","following_url":"https://api.github.com/users/bengland2/following{/other_user}","gists_url":"https://api.github.com/users/bengland2/gists{/gist_id}","starred_url":"https://api.github.com/users/bengland2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bengland2/subscriptions","organizations_url":"https://api.github.com/users/bengland2/orgs","repos_url":"https://api.github.com/users/bengland2/repos","events_url":"https://api.github.com/users/bengland2/events{/privacy}","received_events_url":"https://api.github.com/users/bengland2/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-09T17:08:26Z","updated_at":"2016-09-20T01:55:56Z","closed_at":"2016-09-20T01:55:56Z","body":"pbench-uperf cannot run very large sets of clients and servers at present, because of its port number allocation.  \r\n\r\n**Analysis:**\r\n\r\nI ran a test like this:\r\n\r\n    -=>>cat pbench-uperf.sh \r\n    c=\"172.18.64\"\r\n    pbench-uperf -t stream -p tcp -i 8 -r 120 -m 4194304 -p tcp \\\r\n      -C c07-h05-6048r,c07-h09-6048r,c07-h13-6048r,c07-h17-6048r,c07-h21-6048r,c07-h25-6048r,c07-h01-6048r,$c.232,$c.240,$c.229,$c.242,$c.235,$c.245,$c.248 \\\r\n      -S c07-h01-6048r,c07-h05-6048r,c07-h09-6048r,c07-h13-6048r,c07-h17-6048r,c07-h21-6048r,c07-h25-6048r,$c.240,$c.229,$c.242,$c.235,$c.245,$c.248,$c.232\r\n\r\nand @ndokos  noticed that the last thread did not succeed in connecting to the uperf server.  I noticed that the error for the last thread was:\r\n\r\n    Error connecting to 172.18.64.232\r\n    ** TCP: Cannot connect to 172.18.64.232:34000 Connection refused\r\n\r\nI found an article [here](http://stackoverflow.com/questions/113224/what-is-the-largest-tcp-ip-network-port-number-allowable-for-ipv4) discussing TCP port number usage and it mentioned that there were constraints on what TCP port numbers a process could bind to, defined here:\r\n\r\n    # cat /proc/sys/net/ipv4/ip_local_port_range\r\n    32768\t60999\r\n\r\nThe way that pbench assigns port numbers to uperf servers is starting at 21000 in increments of 1000.  There were 14 uperf servers created in the above test, so by the time we get to the last thread we are above this limit.   I then ran a test with only 10 threads and I do not see the error.  \r\n\r\n**Conclusion:**\r\n\r\npbench-uperf could support much larger tests by incrementing port number by 10 for each new thread instead of by 1000.     This would in theory make pbench-uperf able to scale to roughly (32000-21000)/10 = 1100 threads.\r\n\r\nWhat if some other process has bound the port number?  This is likely to happen for large tests.  A solution would be to detect that the port number is in use with equivalent of \r\n\r\n    netstat -an | grep tcp | grep -q \":$candidate_port \"\r\n\r\nand skip to next one - it really doesn't matter which port number we use so long as it is a valid port number that no one else is using and the client knows which one to use.  I might submit a PR for this if people agree."}}
{"actor":{"display_login":"ndokos"}}