By JV on Friday, 26 June 2015
Posted in General Issues
Replies 5
Likes 0
Views 565
Votes 0
In your Cron Job documentation, you provide this scenario:
John posted a comment on an update which has 10,000 previous comments. To deliver 10,000 emails as soon as you post a comment would take more than an hour. Would you want your user's to wait?

Two questions:

1. I don't understand this scenario. If there are 10,000 emails to send and it takes an hour to send them on page load, how does a cron job send them any faster? It still has 10,000 emails to send. Wouldn't the users have to wait anyway? Especially if the cron job is set to run, say, only once per hour or half-hour?

2. At what point would I even need to use a cron job? I understand in your scenario, that if somebody comments on an update that has had 10,000 previous comments by unique users, then indeed, 10,000 emails would be generated, and this could cause problems sending them on Page Load. But what about a small site, with say 1000-2000 users, Would a cron job be necessary? The site is on a single-core VPS with 2GB RAM.
Hi JV,

I am really sorry for the delay of this reply as it is a weekend for us here.

Regarding this situation, you can actually reduce your cronjob time interval to around 5 minute or maybe 2 minute per time, so at the same time you have to setup how many email you want to send out like every 5 minute or within 2 minute. (Check my screenshot : http://screen.stackideas.com/2015-06-26_0219.png ). But I wouldn't like encourage setup very high value, because the script will hitting time out issues, example :

Cron time interval | Email process at a time
---------------------------------------------------------------------------
2 minute | 1000

When the cronjob processing that time, the system haven't send out 1000 email to user, the cronjob already process second time after 2 minute, so it will have some issues here.

Cron time interval | Email process at a time
---------------------------------------------------------------------------
2 minute | 20

If you wouldn't like your user wait for cronjob run every 30 minute, you can reduce to 2 minute and set the email process at a time to 20.

Regarding with your analysis above, yes, you can actually using "emails on Page Load" in small site.
·
Saturday, 27 June 2015 12:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi JV,

1. I don't understand this scenario. If there are 10,000 emails to send and it takes an hour to send them on page load, how does a cron job send them any faster? It still has 10,000 emails to send. Wouldn't the users have to wait anyway? Especially if the cron job is set to run, say, only once per hour or half-hour?

Yes, the different is if you using "Sending Email on Page Load" you have to wait someone visit on your Easysocial page, the system only process the email to the user.
If compare with Cronjob, that is more nicely, because you can set how many minute you would like to process and at the same time you can configure how many email you want to send out per cronjob is run. (Check my screenshot : http://screen.stackideas.com/2015-06-26_0219.png )

2. At what point would I even need to use a cron job? I understand in your scenario, that if somebody comments on an update that has had 10,000 previous comments by unique users, then indeed, 10,000 emails would be generated, and this could cause problems sending them on Page Load. But what about a small site, with say 1000-2000 users, Would a cron job be necessary? The site is on a single-core VPS with 2GB RAM.

Yes, I would like to suggest you setup the cronjob in your site, so it will automatically send out the email notification to your user and no need wait for someone visit on your Easysocial page then only send out the email notification.
·
Friday, 26 June 2015 02:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes, the different is if you using "Sending Email on Page Load" you have to wait someone visit on your Easysocial page, the system only process the email to the user.


I'm sorry. I still don't understand. I have admin set to "Email on Page Load". Let's say I belong to a group. If someone posts in that group, an email is immediately generated and sent to me, telling me someone posted in the group. I don't have to wait for anyone to "visit the Easysocial page". The email is sent immediately. There is no wait. On the other hand, if I set a cron job to send the emails every half hour, I have to wait a half hour to get that email, isn't that correct?
JV
·
Friday, 26 June 2015 02:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello JV,

I am sorry for the delay of this reply.

Cronjob is basically used to minimize the page load on your site. Let's say there are about 10,000 user currently visiting on your site and they constantly refreshing the page at the same time (10,000 page load in 1 second), that can caused some massive load on your site thus slowing the site down. Cronjob is used to optimize this issue as the email will only get processed at specific interval time and the process is on the server site, thus improving the speed of your site.

Hope these can clarify your issue.
·
Friday, 26 June 2015 11:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Ezrul,

Thank you for your explanation of why the cronjob is used, and I think you answered my most recent question, which was, if I set a cronjob to run every 30 minutes, then when somebody posts an update in a group, for example, then the other members of that group will have to wait as long as 30 minutes to get their email notification. Whereas, if I just set email notifications to occur on Page Load, then the email will be sent immediately, and the members of the group will not have to wait for the cronjob to run.

And I believe this answers my original question, which was basically asking: On a small site, with 1000-2000 users total (and maybe no more than 100 ever online at the same time), would a cronjob even be necessary, especially on a site on a single-core VPS with 2GB RAM? It seems to me the answer would be "no".

If I understand correctly, on a small site, it is probably best to just send the emails on Page Load, so users do not have to wait for the cronjob. And yes, if someday I have 10,000 users online at the same time, I should definitely switch to the cronjob.

If anyone sees an error in my thinking, please let me know!

Thanks!
JV
·
Saturday, 27 June 2015 07:43
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post