Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

Recent Posts Automatic Updater

Aloittaja Major Minor, syyskuu 12, 2013, 03:31:51 IP

« edellinen - seuraava »

Major Minor

Lainaus käyttäjältä: Arantor - syyskuu 17, 2013, 10:13:28 AP
Unlikely.

Consider what's actually going on with this... every single user on the site, guests included, is making a call to the website every few seconds, each of which requires thousands of lines of code to be executed. If you have 100 users, that's 100 requests every 5 seconds - averaging 20 requests per second, far far more than most shared servers can handle.

Heck even a VPS might struggle with that.
And if you look at their forum it says there are more than 6000 users online.  So the requests must me much more demanding then what you describe. I'm sure there's got to be a different, more efficient way of doing this, right?

Arantor

No, there isn't. The way they're doing it is indeed a new poll every few seconds which does necessitate a lot of extra load in the process.

However they were quite smart about it, so let's break it down and explain why what they're doing actually fits everything I originally pointed out.

The polling is done every few seconds to live.kanyetothe.com rather than the main site. This extra subdomain has a different IP address - very likely a different server entirely (hint: this is a small cluster, a smaller version of what a datacenter is, a lot of machines doing the work), this extra server does not appear to be running PHP at all and certainly doesn't bother doing authentication.

This saves you a fair amount of work, because you only need to care about the most important data, i.e. the topic data itself, but doesn't work if you want to be user-specific about it, you can only ever have the stuff that's completely public in there.

Those 6000 users online can easily generate thousands of requests per minute, hundreds per second in most cases - and a suitably expensive server can probably handle that, especially if it's using nginx with something like Node.js on the backend to manage it and keep it transiently active.

This is not something you will be able to do on low end shared hosting. Hell, this will require a minimum of a VPS to pull off, more likely a dedicated server - which means you're getting into the realms of hundreds of dollars a month to run it.
Holder of controversial views, all of which my own.


samborabora

What's the easiest way of adding recent posts to the right side of the board, without an auto refresh? Would that be okay for shared hosting

Arantor

Easiest way is to use a portal, they all have a recent posts block (and come with a sidebar)
Holder of controversial views, all of which my own.


samborabora

To be honest, I'd rather not go through the whole front end of a portal, I'd rather just recode a sidebar into the main boards template, is there anything by default SMF that can be called to give out recent posts?

Arantor

You do know that the portals can be configured not to do that, right?
Holder of controversial views, all of which my own.


samborabora

Do you mean it's possible to just use a portal to display a sidebar with recent posts?

Arantor

Sure it is. Pretty sure all the portals can do that.
Holder of controversial views, all of which my own.


samborabora

You're right, I did it with SP, thanks!

Advertisement: