Re: [DOCS] Replication - super-draft

2006-07-25 Thread Markus Schiltknecht

Hello Chris,

thank you for putting this together. It seems to be the replication 
guide we are looking for: an overview over the principles and solutions 
of replication for PostgreSQL. Good work!


Some suggestions I came up with when reading: when preparing my 
presentation I came to the conclusion that first introducing 'single- vs 
multi-master' before 'sync vs async' is easier. Especially because of 
the 'after-commit-conflicting-transactions' problem that rises in async, 
multi-master solutions, YMMV.


Being the Postgres-R (8) guy, I of course have some additions to that 
paragraph: You mention Postgres-R being only usable on rather old 
releases. Please also mention that I'm actively working on a production 
grade Postgres-R for an up-to-date PostgreSQL version. There already is 
a downloadable, working prototype.


Concerning Slony-II: AFAIK there is no mechanism to detect conflicts 
earlier for normal transactions (maybe for DDL or TABLE LOCKS or 
something, but mentioning that here is misleading). Such a distributed 
locking mechanism would increase network traffic - and decrease total 
performance.


Because Slony-II and Postgres-R are that similar, they also share the 
'problems that emerged'. Because Slony-II and Postgres-R are coceptually 
mostly identical, I'd propose to merge those two paragraphs. You might 
want to add that both projects were created independently, but their 
authors currently plan to join their work and efforts.


A nit-picking detail: I'm unsure about the correct english spelling of 
single- and multi-master ('single master', 'single-master' or 
'singlemaster'), but please make sure to use a consistent spelling.


Regrards

Markus

Chris Browne wrote:

Here is a "real drafty beginning" to a set of docs on replication.

Bruce was soliciting this at the Code Sprint...  Nobody really promised it

Here's a beginning to it.  It's based on my impressions; I don't care
how much it gets "hacked up" from here.  Hopefully it will be quicker
to start with this than to start from the beginning with something
else.
  




  Replication 

  replication

   People frequently ask about what replication options are
  available for PostgreSQL.
  Unfortunately, there are so many approaches and models to this
  that are useful for different purposes that things tend to get
  confusing.
  

   At perhaps the most primitive level, one might
  use  tools,
  whether 
  or  to create additional
  copies of databases.  This doesn't provide
  any way to keep the replicas up to date; to bring the state of
  things to a different point in time requires bringing up another
  copy.  There is no way, with these tools, for updates on
  a master system to automatically propagate to the
  replicas.

  Categorization of Replication Systems 

   Looking at replication systems, there are a number of ways in
  which they may be viewed:

  

   Synchronous versus asynchronous

  Synchronous systems are ones where updates must be
  accepted on all the databases before they are permitted
  to COMMIT. 

   Asynchronous systems propagate updates to the other
  databases later.  This permits the possibility that one
  database may have data significantly behind others.  Whether
  or not being behind is acceptable or not will depend on the
  nature of the application.
  

   Single master versus multimaster.

   That is, whether there is a single database
  considered master, where all update operations
  are required to be submitted, or the alternative, multimaster,
  where updates may be submitted to any of several
  databases.

   Multimaster replication is vastly more complex and
  expensive, because of the need to deal with the possibility of
  conflicting updates.  The simplest example of this is where a
  replicated database manages inventory; the question is, what
  happens when requests go to different database nodes
  requesting ` a particular piece of inventory?

   Synchronous multimaster replication introduces the need
  to distribute locks across the systems, which, in research work
  done with Postgres-R and Slony-II, has proven to be very
  expensive. 

   Asynchronous multimaster replication introduces the
  possibility that conflicting updates will be accepted by
  multiple nodes, as they don't know, at COMMIT
  time, that the updates conflict.  It is then necessary to have
  some sort of conflict resolution system, which can't really be
  generalized as a generic database facility.  An instance of this
  that is commonly seen is in the PalmOS
  HotSync system; the general policy
  when conflicts are noticed is to allow both conflicting records
  to persist until a human can intervene.  That may be quite
  acceptable for an address book; it's not
  fine for OLTP systems. 

  

   Update capture methods  

   Common methods include having triggers on tables,
  capturing SQL statements, and capturing transaction log (WAL)
  updates 

  

   Triggers, as used in eRServer and Slony-I,
  have

Re: [DOCS] Replication - super-draft

2006-07-25 Thread Markus Schiltknecht

Hi,

Chris Browne wrote:

Under conditions where one expects to see a lot of conflicting
updates, pushing out locks earlier would allow sooner discovery of
these conflicts; whether this improves or worsens total performance is
at least a bit ambiguous.


That's a good point, yes. Given one gets lots of conflicts, one should 
probably go for async (or single master) replication anyway. (Or see the 
performance degrade below single-node operation, which is imaginable for 
both approaches, IMHO. Finally, only benchmarking will tell.)


[ In single node operation, we have READ COMMITTED vs. SERIALIZABLE, 
which is pessimistic vs. optimistic. Correct me if I'm wrong, but in 
general I thought, optimistic locking (SERIALIZABLE) is prefered and 
leads to better performance. That's why came to think the same holds 
true for replication. Or is READ COMMITTED better if you have lots of 
conflicting transactions? Any numbers on that? ]


Coming back to thinking about the replicaiton doc... the draft describes 
the different types of replication very well. But no all users will 
immediately see what each type is good for. Therefore we should probably 
also cover some use cases, i.e. what type of replication to use when. 
The most frequently asked use case probably being a hot-backup with 
failover capability -> single-master, async / sync, depending on your 
needs. Another use case could probably describe a multi-master scenario 
and outline pros and cons of that (perhaps gently touching the above issue?)


Another issue that comes to mind: PgCluster2 targets shared-disk 
clusters, a significant difference to shared-nothing clusters. Maybe 
that gives another paragraph under 'categorization'?


Given that additional categorization: should the use cases be added per 
replication solution?



A nit-picking detail: I'm unsure about the correct english spelling of
single- and multi-master ('single master', 'single-master' or
'singlemaster'), but please make sure to use a consistent spelling.


That is indeed useful editorial guidance...


Sorry, I must have felt super clever. ;-) Although... as a non native 
english speaker, I would still like to know the preferred spelling.


Regards

Markus

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly