On the site there is a need to send users personal email notifications about some events. More than 3000 users have already signed up for some events.
The script works according to the crown, takes a task from the database, creates a letter template, then selects a list of recipients from the database (MySQL) and in the loop substitutes the MemberName, MemberMail template and sends it as banal mail (). Letters are small (<1 KB) without attachments. Further letters is engaged in exim.
The problem is that the distribution takes a very considerable time (namely the execution of the specified php-script). For example:
421 letters - 37.764 p.
858 letters - 95.971 seconds
1337 letters - 217.12 p.
1607 letters - 301.72 seconds
It is clear that you can redo the queue and send out 100 letters or there are 200, but the question is different - is the execution time of such a script normal? Can the script be optimized in principle?
The site runs on a Hezner server (Intel® Core ™ i7-2600, 16 GB DDR3).