I built an email alert for my users (now are only 2,000) so every night a crontab execute a php script that query the mysql to find matches with user's saved search. it's a classified website in my case, but i would like to learn in case i had to build something for bigger clients
my concerns are:
what happen if my user grow x10 or x100 times? is the server going to crash? there any tip you can suggest on manage something like that?
there is any way to protect my file cron/nightly_script.php to be executed form outside calling it in the url of the browser? consider tham im using a string in crontab like:
lynx [absolute url/script.php]
what about the email blast? for each query if the query has results the script sends an email, so it means a blast of emails...is it going to be considered spam automatically and then i could blacklisted?
thanks!!!
what happen if my user grow x10 or x100 times? is the server going to crash? there any tip you can suggest on manage something like that?
Your server could crash/get slow as hell because of extensive memory/cpu usage. You should use a message queue like redis/beanstalkd/gearmand to throttle your email alerts. My preference goes out to redis. use the blocking pop/push with predis library which support blocking pop/push.
there is any way to protect my file cron/nightly_script.php to be executed form outside calling it in the url of the browser? consider tham im using a string in crontab like:
Don't use cron if you want to scale. Instead create couple of daemons.
Daemons don't need to be spawned each time and spawning processes is (relative) expensive. Second your script should not call any URL anymore but instead call the PHP scripts directly(CLI).
what about the email blast? for each query if the query has results the script sends an email, so it means a blast of emails...is it going to be considered spam automatically and then i could blacklisted?
When using a message queue you can throttle yourself!