Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About brentman

  • Rank
    Regular Member

Profile Information

  • Gender
    Not Telling
  1. I have another table that I suspect is having collisions as well as I still am seeing decrease performance with more scripts running although now I am up to 5 before performance degrades. This one cannot be fixed simply with InnoDB though. Lesson from thread, pay more attention to query and DB design. At work but will get some code posted later or this weekend.
  2. Found the problem. My main table was not set on InnoDB *facepalm* so each instance I was making was waiting to complete updates and with each new instance it made it run slower and slower as it was having to wait for more likely collisions on the table. Quick change made it significantly faster but I will play around more with it later and see if that is the only problem.
  3. 1. Well it doesn't send emails but it runs through all the loops and things, just doesn't actually send it out. 2. They are the same server. It has multiple cpanel accounts with a different domain and ip for each. *The end goal is to have it on different servers at some point so it isn't helpful for me to make it a one server solution.
  4. No. All the data is on Server A. It sends the data to other servers B, C and D who actually send the email out. Currently, it is all done on one machine but under different cpanel accounts, domains, ips. In the future I will be moving it/ adding more on other physical machines, or at least should have the option. The actual code that emails is pasted prior in the thread. It cannot possibly be the http request because I can comment it out and there isn't a significant increase in performance. It's about 10%. I am running a duel hexacore 2.4ghz, it really should be able to handle running a php loop and some queries so that shouldn't be the problem. And without the http request that cannot be the problem either. It does do about 6 mysql queries one of which is checking against a table of 700,000 records, the others are checking against other tables with about 100k records and one pulling the info and one writing the final statuses and stuff. All of which is in a loop. Each record does need to be checked just prior to emailing so I cannot significantly change the function that is taking place. Although I have tried commenting it out just to test and it had very little effect on performance. The entire file is 484 lines with plenty of spacing and such, just to give you an idea of how much is going on. Most of it falls into two features, one is manipulating the message. ie Dear Joe to joe but Hey Friend to someone without a name etc. each email is quite personalized, more so than most people are doing. The second main feature is checking the email vs all my black lists I have acquired and other checks for proper formatting, likelyhood of being good address, etc. ie. brentman@gmail.com is ok to send to but brentman@northkorea.kp is not ok.
  5. Sure. I just commented it out and ran it again and it was only about 10% faster. That still isn't my main bottleneck. Check this: 1 Instance 1.97 Seconds/Email | Single Script Speed 1.60 Seconds/Email 2 Instances 1.37 Seconds/Email | Single Script Speed 1.98 Seconds/Email each 3 Instances 1.10 Seconds/Email | Single Script Speed 2.51 Seconds/Email each 4 Instances 1.04 Seconds/Email | Single Script Speed 3.10 Seconds/Email each They are measured slightly different (so don't try to run math on it) but the trend is what is bothering me? Why would running a script once vs twice vs 3 vs 4 times make a difference in the performance of the script on an individual basis unless as a whole they are maxing something out. There is no difference between a spammer and a regular emailer other than spammers don't have people opt in to be contacted and legit people do. I have people opt in to me and I provide a way to unsubscribe from my newsletters that I am sending, therefore not spammer. Lets talk about the topic please.
  6. I replaced file_get_contents with the following cURL: // GET Options curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $api_string, CURLOPT_USERAGENT => 'Codular Sample cURL Request' )); // Send Request $resp = curl_exec($curl); $htmlAttr = ($resp === FALSE)?'false':'success'; Improvement was negligible... ballpark of maybe 4% speed increase.
  7. I don't need to go crazy. It should be able to be accomplished with one machine. I am using like 1% of the machine power! Would using curl or fsocket be faster? I have never seen an example of asynchronous done so I don't really know where to begin logically to make that work. Google has not been extremely helpful with this either. Found this that looks interesting as well: http://php.net/curl_multi_init
  8. This is what I am doing: //bunch of logic up here $to = 'jones@yahoo.com'; $from = 'admin'; $subject = 'Hello, quick reminder about your account'; $body = 'body here'; $random_domain = rand(1,2); if ($random_domain == 1) { $domain = 'mysite.com'; } else { $domain = 'myblog.net'; } file_get_contents('http://' . $domain . '/?to=' . $to . '&from=' . $from . '@' . $domain . '&subject=' . $subject . '&body=' . $body); //end script Then the file I am file getting contents from is what I pasted above in prior message. This way the message is all generated in one file but two different domains send it out. On each of myblog.net and mysite.com have the actual mail() command script on them.
  9. I am a professional emailer. I have all that under control. Been out for awhile but now I am back and I don't want to spend $1000 to make $1000 you know? No I email to peoples lists on their behalf. No spamming. I am not totally sure what you are suggesting instead. Reason I am doing this is so that I can send email from two different domains.
  10. I am not using a mail service. They are pretty expensive. To even just mail the volume I am currently doing with the server would cost me about $750 per month. I don't know much about mail servers. Do you have any recommendations I can look into?
  11. I found this too but I don't know really what it does. http://pear.php.net/package/Mail
  12. Well I know of email systems that email off servers much faster. They may not be using php though. I tried using multiple instances and it kinda went faster. I was able to achieve about 70/min but I couldn't get it to stay at that rate, it fluctuated wildly as the instances started and stopped. I am not opposed to switching languages or whatever to get it going. I really need to figure this out. Totally different realm of code but MailChimp uses php and they are mailing 400mm per day for their clients. So it has to be possible.
  13. I am emailing off my server and its really slow. I think the problem is my logic, not the code. Current speed is about 30-40 emails per minute. I need to get it up to at least 175/min but I was really hoping for more like 700/min. The server is a Dual Hexa-Core 2.4Ghz with 32gb ram and dedicated to only this task. All server reports show low resource usage. The logic flow is like this: 1. Get email content. 2. Loop through records in database. 3. Check record against some other tables (ie unsubscribe table) 4. If record checks then send email by file_get_contents passing all the email content through get variables. 5. Other script is basic email script. See below: <?php //GET VAR INPUT $to = htmlentities($_GET['to']); $friendly_from = htmlentities($_GET['friendly_from']); $email_from = htmlentities($_GET['email_from']); $subject = htmlentities($_GET['subject']); $text = htmlentities($_GET['text']); $html = $_GET['html']; $html = '<head><title>' . $subject . '</title></head><body>' . $html . '</body>'; //SEND EMAIL # Setup mime boundary $mime_boundary = 'Multipart_Boundary_x' . md5(time()) . 'x'; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\r\n"; $headers .= "Content-Transfer-Encoding: 7bit\r\n"; $headers .= "Reply-To: " . $email_from . " \r\n"; # Add in plain text version $body.= "--$mime_boundary\n"; $body.= "Content-Type: text/plain; charset=\"charset=us-ascii\"\n"; $body.= "Content-Transfer-Encoding: 7bit\n\n"; $body.= $text; $body.= "\n\n"; # Add in HTML version $body.= "--$mime_boundary\n"; $body.= "Content-Type: text/html; charset=\"UTF-8\"\n"; $body.= "Content-Transfer-Encoding: 7bit\n\n"; $body.= $html; $body.= "\n\n"; # End email $body.= "--$mime_boundary--\n"; # <-- Notice trailing --, required to close email body for mime's # Finish off headers $headers .= "From: " . $friendly_from . " <" . $email_from . ">\r\n"; $headers .= "X-Sender-IP: " . $_SERVER[SERVER_ADDR] . "\r\n"; $headers .= 'Date: ' . date('n/d/Y g:i A') . "\r\n"; //Mail it out $response = mail($to, $subject, $body, $headers); //RESPONSE (Success = 1, Fail = 0) echo $response; die(); ?> The entire thing runs on a cron job every minute checking with a lock to prevent multiple instances as the file usually executes for about 5 minutes. I have tried turning off parts of the code and retesting such as many of my database look ups but as you would expect they optimize by like 1% or something very little like that. The thing that takes a long time is the actual sending of the email. So how to get that to go faster?
  14. Yes I do. I am using htmlentities on the variables right before this and it is password protected pages that are only for me.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.