I have web-server (nginx) with 1 Gbps port. How can I limit total trafic (sum of input and output) of the server to 100 TB per month?
Asked
Active
Viewed 156 times
-3
-
I have no idea how to do this, even have no idea how to start search - can you give me any idea to start with? – glagola Aug 14 '13 at 15:47
-
Ask your service provider to cap it for you? If you're not the server or network admin, then you should rely on the people that you're paying for the service, because they are. – mfinni Aug 14 '13 at 15:53
-
1Get a 40 MBps connection? – ceejayoz Aug 14 '13 at 15:53
-
2We don't generally do this level of support here we expect questions to be reasonably scoped adn for people asking them to have some clue as to what they're doing. – user9517 Aug 14 '13 at 15:54
-
@ceejayoz That's 40MBps, or about 320 Mbps.. Capitalization matters. – Chris S Aug 14 '13 at 15:56
-
@ChrisS Crap, you're right. Thanks for the correction! – ceejayoz Aug 14 '13 at 15:57
1 Answers
2
Use Linux traffic control to limit the whole interface to 319Mbps.
The 319 came from Google. They assume 30.4 days in a month. 60% of the time it's right all the time...
Normally, transfer and storage sizes use binary prefixes (ie kb = 1024b; yes this is incorrectly using the 'kilo-' prefix, and should be using 'kibi-'... not getting into that). Line rates correctly use SI prefixes. With that in mind the calculation should be:
109951162777600 bytes per month (100 * 1024^4)
3546811702503 bytes per day (assuming a 31 day month for safety)
328408491 bits per second - aka 328 Mbps
Using correct SI prefixes throughout:
100000000000000 bytes per month (100 * 1000^4)
3225806451612 bytes per day
298685782 bits per second - aka 299 Mbps
Using all binary prefixes:
328408491 bits per second - aka 313 Mibps
Check the fine print of your hosting company for which method they use.
Your 339Mbps comes from using 30 days in a month, even though only a third have 30...

Chris S
- 77,945
- 11
- 124
- 216
-
I've made more precise calculations and get 339 Mbps. Nevertheless thanx for the link! – glagola Aug 14 '13 at 16:06
-