benchmark your server (Mail Function)
Posted: Wed Mar 24, 2004 11:33 am
hi guys
i came up with this test last night after finally getting my local mail server working again :@
basically it tests how long it takes your server to send 100 e-mails and then calculates how long it would take to send various amounts, including 1000, 50,000, 1 million and even a billion amongst many others.
you only need to change the variable $email to your own e-mail server
I didnt develop this script to test how many e-mails i could send at once in a 'real-world' environment as i have absolutely no need to send more than say 100 at a time maximium, not in an of my current projects mind, i just wanted to try and emulate the sorts of volume that major mail providers must send all the time (msn, yahoo etc) and mainly to test just how fast my PHP server could cope with such volumes and scripts
i initially ran the script with 50,000 emails to myself, needless to say PHP died a horrible death calling out of memory, so i lowered the number and decided to calculate from there, also this made it easier to share my script with others to benchmark
i chose 100 mainly to get a fairly accurate score however its still a little inconsistent but very fun to see how many a billion e-mails would take to send,
i decided to wrap the majority of the code in some functions, after initially doing it without them, but it got too complex, which is my first time of using functions and im definitely going to be using them in the future, also it was the first use if ever needed for an else/if statement it actually added
an extra 18 lines of code to the script, but made is so much easier to 'administer'!
this script works without any database and was created using PHP 4.2.2 with only the GD Module as a non-standard package (which it doesnt use)
how did your server do?
the script is here for download
if any of you are worried about the sudden influx of 100 e-mails hitting your mailbox, dont worry, the total file size for all 100 is only 65kb, plus you could always set up that e-mail address as junkmail, it will still get there and wont harm the script at all
there is only one problem with this script which i am unaware of how to format
say you get a return of 16.14 Minutes, this does not mean 16 Minutes and 14 Seconds it means .14 of a minute so 16 minutes and around 8 seconds, just so you know, seconds work perfectly if anyone can advise me on how to change this it'd be appreciated
Please post your results here so we can all compare and hopefully find ways of running our servers at optimium performance
also i could of further improved the script by doing something like the following
instead of
lines of code(inc. comments):297
of which are mail functionality:100
and defining functions:82
Thanks
Mal
i came up with this test last night after finally getting my local mail server working again :@
basically it tests how long it takes your server to send 100 e-mails and then calculates how long it would take to send various amounts, including 1000, 50,000, 1 million and even a billion amongst many others.
you only need to change the variable $email to your own e-mail server
I didnt develop this script to test how many e-mails i could send at once in a 'real-world' environment as i have absolutely no need to send more than say 100 at a time maximium, not in an of my current projects mind, i just wanted to try and emulate the sorts of volume that major mail providers must send all the time (msn, yahoo etc) and mainly to test just how fast my PHP server could cope with such volumes and scripts
i initially ran the script with 50,000 emails to myself, needless to say PHP died a horrible death calling out of memory, so i lowered the number and decided to calculate from there, also this made it easier to share my script with others to benchmark
i chose 100 mainly to get a fairly accurate score however its still a little inconsistent but very fun to see how many a billion e-mails would take to send,
i decided to wrap the majority of the code in some functions, after initially doing it without them, but it got too complex, which is my first time of using functions and im definitely going to be using them in the future, also it was the first use if ever needed for an else/if statement it actually added
an extra 18 lines of code to the script, but made is so much easier to 'administer'!
this script works without any database and was created using PHP 4.2.2 with only the GD Module as a non-standard package (which it doesnt use)
how did your server do?
the script is here for download
if any of you are worried about the sudden influx of 100 e-mails hitting your mailbox, dont worry, the total file size for all 100 is only 65kb, plus you could always set up that e-mail address as junkmail, it will still get there and wont harm the script at all
there is only one problem with this script which i am unaware of how to format
say you get a return of 16.14 Minutes, this does not mean 16 Minutes and 14 Seconds it means .14 of a minute so 16 minutes and around 8 seconds, just so you know, seconds work perfectly if anyone can advise me on how to change this it'd be appreciated
Please post your results here so we can all compare and hopefully find ways of running our servers at optimium performance
also i could of further improved the script by doing something like the following
Code: Select all
// pseudo code
mail("$email", "$subject", "$message", "$headers") * 100;
// but this wont work
// i believe i would need to create a loop statement, but
// am unsure on the syntax of this sort of thing as ive only worked
// with queries - so bech if your readingCode: Select all
mail("$email", "$subject", "$message", "$headers");
mail("$email", "$subject", "$message", "$headers");
mail("$email", "$subject", "$message", "$headers");
mail("$email", "$subject", "$message", "$headers");
// etc etcof which are mail functionality:100
and defining functions:82
Thanks
Mal