Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Okay, I have an idea.

  • 11-05-2006 8:09pm
    #1
    Administrators, Entertainment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 18,773 Admin ✭✭✭✭✭


    Sometimes, for some reason, posts get mixed up so that user1 posts and then user2 posts, but user2's post is displayed as having been posted before user1's.

    I was wondering could this be down to different timers between pie.boards.ie and [noparse]www.boards.ie?[/noparse] I noticed that if I refreshed the main page on both at about the same time (give or take a few tenths of a second), that one seems to be behind the other. Could this explain the ghost away?

    Edit: I have a feeling this might actually have been worked out before, in which case, sorry!
    Post edited by Shield on


Comments

  • Registered Users, Registered Users 2 Posts: 4,839 ✭✭✭Hobart


    Sometimes, for some reason, posts get mixed up so that user1 posts and then user2 posts, but user2's post is displayed as having been posted before user1's.

    I was wondering could this be down to different timers between pie.boards.ie and [noparse]www.boards.ie?[/noparse] I noticed that if I refreshed the main page on both at about the same time (give or take a few tenths of a second), that one seems to be behind the other. Could this explain the ghost away?

    Edit: I have a feeling this might actually have been worked out before, in which case, sorry!

    I would doubt it tbh. I doubt that the DB is shared across two servers. I imagine that pie is just a part of the www .

    Sounds to me as if there is just a bug in the VB software.


  • Registered Users, Registered Users 2 Posts: 5,049 ✭✭✭Cloud


    No Hullabaloo is right; we have two web servers that will use different dates when posts are created sometimes, and the times have to be periodically aligned - I will see if we can get them to take their times from an NTP server...

    Edit: Just checking there, the times seem to be very close together (1 second), so are the posts just out by a matter of seconds?

    statler> date
    Fri May 12 11:41:24 IST 2006
    beaker> date
    Fri May 12 11:41:25 IST 2006


  • Registered Users, Registered Users 2 Posts: 10,304 ✭✭✭✭koneko


    Yeah it's usually when someone quickly replies to the first post in a thread. Their reply ends up being the first post, and the original post is listed as a reply.


  • Registered Users, Registered Users 2 Posts: 21,081 ✭✭✭✭Stark


    Could you use the database server time as the post time rather than the web server time?


  • Registered Users, Registered Users 2 Posts: 4,839 ✭✭✭Hobart


    Cloud wrote:
    No Hullabaloo is right; we have two web servers that will use different dates when posts are created sometimes, and the times have to be periodically aligned - I will see if we can get them to take their times from an NTP server...

    Edit: Just checking there, the times seem to be very close together (1 second), so are the posts just out by a matter of seconds?

    statler> date
    Fri May 12 11:41:24 IST 2006
    beaker> date
    Fri May 12 11:41:25 IST 2006
    Well knock me down with a stored procedure.

    Why would it be configured as such? I assume the text (posts) are stored in a DB os some kind, is this DB spread across 2 servers?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 4,003 ✭✭✭rsynnott


    NTP would surely be the easy way out?


  • Closed Accounts Posts: 17,163 ✭✭✭✭Boston


    Hobart wrote:
    Well knock me down with a stored procedure.

    Why would it be configured as such? I assume the text (posts) are stored in a DB os some kind, is this DB spread across 2 servers?

    Now bear in mind i don't have a clue about how boards.ie is set up. But you have a single DB, accessed by clients, in this case the web servers, each client has a clock, each request to access the the db gets time stamped. If two requests come in concurrently (ultimately the goal of having more then one server) then the request with the lower time stamp get get priority, or higher, point is this is used to determine the scheduling for the DB access. If the clocks are out of sync, then you can get a situation where a db access in real time which happens after another access gets processed before. Solution, sync with external clock.

    Now that just might be whats going on here, I don't know, as I said there are different models, and thats just a very simple view of one of them. As for why they would have more then one clock in the first place, it makes distributed systems more robust imho.


  • Registered Users, Registered Users 2 Posts: 21,081 ✭✭✭✭Stark


    Hobart wrote:
    Well knock me down with a stored procedure.

    Why would it be configured as such? I assume the text (posts) are stored in a DB os some kind, is this DB spread across 2 servers?

    Simplicity? Two database servers would mean two databases to be constantly kept in sync, otherwise people on pie would see different threads to people on www.


  • Registered Users, Registered Users 2 Posts: 654 ✭✭✭DS


    What about modifying the insertion query VB generates to use the time on the DB server when inserting a post, rather than the time on whatever server the script is being run on.


  • Closed Accounts Posts: 17,163 ✭✭✭✭Boston


    well VB is an application that sits on top of system subroutines. It's time is irrelavent, to the time stamp clock. VB's time is based on the 24 hour clock, the timestamp clock could be 64bit number. It just couldn't make sense. And even if you did sync with the vb clock, it's probably drivived from some external clock, so it would be better to sync with that one.

    Btw this is all conjecture on my part.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 6,762 ✭✭✭WizZard


    That's very strange that vB is using the time on the webserver(s). I would've thought it would use the time on the DB server?


  • Closed Accounts Posts: 17,163 ✭✭✭✭Boston


    While I'm not saying it's one way or the other, The VB software runs on the webservers, so why wouldn't it use the servers clock?


  • Registered Users, Registered Users 2 Posts: 3,280 ✭✭✭regi


    Its probably generated in the PHP, and that value shoved into the DB.


  • Closed Accounts Posts: 4,842 ✭✭✭steveland?


    WizZard wrote:
    That's very strange that vB is using the time on the webserver(s). I would've thought it would use the time on the DB server?
    Why?

    I'd assume it uses an SQL statement something along the lines of INSERT INTO table VALUES("$post",......., NOW()), where NOW() is the function that just returns todays date (not time afaik)... the point is since the statement that inserts the date is being run from the webserver it's going to be the webserver's date/time

    Don't know what function it is vB uses but it's more than likely it's done webserver-side...

    I'd assume NTP synchronisation would be the simplest to implement


  • Registered Users, Registered Users 2 Posts: 6,762 ✭✭✭WizZard


    NOW() returns the DB server time. It's a function and is run when the SQL is run, i.e. on the DB server.
    Although if it uses the PHP date function then it's webserver side. :(

    Depending on network latencies etc, NTP can be off my several milli/micro-seconds. it depends on how vB stores post time - and how accurate it is. If it stores right down to millisecond then syncing each webserver to a remote NTP source may not solve the problem (just make it harder to diagnose:))
    If time is THAT important then it's time to use a local atomic clock, or just decide on a single source for the time - usually the DB server as it's more usual to have many webservers in front of one DB server. That way all times are synced. Although issues can still occur due to network problems between the webserves and DB servers.
    Causing many evaluations of the DATENOW/NOW() function on the DB server may stress it a little more though, especially with the kind of traffic boards gets.

    My 2c


  • Closed Accounts Posts: 17,163 ✭✭✭✭Boston


    WizZard wrote:
    NOW() returns the DB server time. It's a function and is run when the SQL is run, i.e. on the DB server.
    Although if it uses the PHP date function then it's webserver side. :(

    Depending on network latencies etc, NTP can be off my several milli/micro-seconds. it depends on how vB stores post time - and how accurate it is. If it stores right down to millisecond then syncing each webserver to a remote NTP source may not solve the problem

    So basically, it depends.
    Causing many evaluations of the DATENOW/NOW() function on the DB server may stress it a little more though, especially with the kind of traffic boards gets.
    My 2c

    Thats probably the best indication that Steveland and Regi right when they say it's generated on the webserver. I mean it's the think that sprung to my mind the minute i started to read the thread.


  • Registered Users, Registered Users 2 Posts: 6,762 ✭✭✭WizZard


    LiouVille wrote:
    So basically, it depends.
    Technically, yes :D:p


  • Registered Users, Registered Users 2 Posts: 4,839 ✭✭✭Hobart


    Stark wrote:
    Simplicity? Two database servers would mean two databases to be constantly kept in sync, otherwise people on pie would see different threads to people on www.
    That's my point actually. I would assume that there is 1 DB. Spreading this DB across 2 servers would complicate the setup. I never thought that there was 2 DB's.
    WizZard wrote:
    That's very strange that vB is using the time on the webserver(s). I would've thought it would use the time on the DB server?
    Me too.


  • Registered Users, Registered Users 2 Posts: 22,231 ✭✭✭✭Sparky


    1 DB connected to two servers as cloud said.
    vB uses the time on the webserver, so it uses the php echo command.

    Would this also explain the phantom thread problem?


Advertisement