views:

32

answers:

1

Hey everyone,

I have written a web application that interacts with Google calendar (adds/edits/updates events). You may have seen one of my many posts about it.

I had been struggling with the fact that sometimes I find my application to be slow on performing calendar operations. I have since come to the conclusion that it is not slow due to the HTTP Request, but because of my GoDaddy shared server.

I have tried two methods of interacting with the calendar:

First, upon login, a connection is made to the Google Calendar and I store that connection token in a session, which I then use on any page needing to make a connection to the calendar. So, I add the event to my database, and then I add it to the calendar.

Second, I do the same thing, except when a user adds/edits/deletes and event, the event is changed in the database, and then a cron job runs on the server every hour and will add the event to the Google Calendar.

I have been looking a lot at script execution times for both methods, and haven't been able to see a clear difference in speeds for either of the two methods. If I had to say, the second method seems to be faster a bit more consistently, but it all depends (sometimes the first method runs faster).

So, my question is, which method should I go with? I can't seem to decide. I've been trying to figure out upsides and downsides but really can't make up my mind. Which method would you guys suggest?

Thanks!

+1  A: 

I would always go with the cron job. As a general rule of thumb I do not make my application dependent on a resource outside of my control.

hobodave
Thanks for your input, hobodave, seems like a smart move, I'll go with that.
behrk2