Replication & web apps - Mailing list pgsql-general

From Leonardo Francalanci
Subject Replication & web apps
Date
Msg-id 44193EFE.3020200@CommProve.com
Whole thread Raw
Responses Re: Replication & web apps  (Jeff Amiel <jamiel@istreamimaging.com>)
List pgsql-general
Hi,

I still don't understand how replication can be used in web applications.
Given this scenario:

1) user updates his profile -> update to the db (master)
2) web app redirects to the "profile page" -> select from db (slave)

Since (2) is a select it is issued to the slave.

How can one be sure that the master propagates the update (1) to the
slave before data is requested from the slave (2)?
And: suppose there is a method to understand that the user made a change
to the db in the web request (as above) so that we have to issue all
queries of the same web request to the master, that is:

1) user updates his profile -> update to the db (master)
2) web app redirects to the "profile page" -> select from db (master
again because in this web-request user made a change to the db)

what if the user ask AGAIN for the "profile page" BEFORE write
propagates to the slave:

3) User ask for a refresh of the "profile page" -> select -> slave
(because user didn't make any change during THIS web request)

???

In other words: how can asynchronous replication be used in an
application???








pgsql-general by date:

Previous
From: "jia ding"
Date:
Subject: Re: \copy combine with SELECT
Next
From: Jeff Amiel
Date:
Subject: Re: Replication & web apps