Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

closed as off-topic by Nathan C, Iain, dawud, Chris S Aug 14 '13 at 15:57

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Chris S
  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Nathan C, dawud
If this question can be reworded to fit the rules in the help center, please edit the question.

2  
What have you tried so far? What didn't work? –  Nathan C Aug 14 '13 at 15:41
    
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
1  
Get a 40 MBps connection? –  ceejayoz Aug 14 '13 at 15:53
2  
We 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. –  Iain Aug 14 '13 at 15:54

1 Answer 1

up vote 2 down vote accepted

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...

share|improve this answer
    
I've made more precise calculations and get 339 Mbps. Nevertheless thanx for the link! –  glagola Aug 14 '13 at 16:06
    
Thanx, I will set up 310 Mibps, just to be sure –  glagola Aug 14 '13 at 20:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.