• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
blocking vs async using guzzle

#1
I am implementing code to write out a copy of my collected data to Amazon S3. S3 uses Guzzle and allows the calls to send the data either sync or async (promises). If each instance of my php program is truly a separate process, then synch should not be a problem. However, if these are really being handled by a single multi thread process then I must do async. 

Does anyone have a deep understanding of how Apache and php interact or can you point me to a white paper? Clearly synch is much easier to implement.
Reply

#2
https://www.youtube.com/watch?v=OEMuHy5Srk8

Here's video of Rasmus explaining how multi-threading works on PHP.

For what I understand from your description, sync or async wouldn't make much difference, because your PHP process on server is running throughout all the subcalls to AWS API.

If you are worried that this once back-end call will take too much resource away from your normal visitors, you should move it to second server instance that does the heavy duty tasks and keep the first server to only handle front end web requests.
Reply

#3
Thanks. That really cleared up things. Part of what I am doing is to keep a copy of the data logs on S3, and thus not on the mysql database which is running on my same server. That is the reason that I am sending it over to s3. But I am also keeping a local copy of the data in my same database so that users can browse it "realtime". Kind of defeats the purpose? Perhaps the answer is to only keep 2 weeks of current data on my local mysql and if the user wants their data, I can email it to them. I just managed to get the writing of data to the s3 working late last night as a proof of concept. Did I mention that I don't have any users yet? Smile.

Do you know of any automatic way to delete records from a mySQL server when they get aged?
Reply

#4
@richb201,

You could create an independent cron tab house keeping job that runs either weekly or monthly and deletes aged records.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.