[erlang-questions] [Zotonic] How to distribute zotonic across multiple machines?

Juan Jose Comellas juanjo@REDACTED
Fri Oct 14 17:28:49 CEST 2011


Slony-I works very well. I've used it for pre-9.0 versions of Postgres with
somewhat big databases (> 60 GB, several tables with over 60 million rows)
and with lots of concurrent read and writes and it could handle them without
problems. Slony modifies your schema and adds triggers to all the tables
that are to be replicated. It is a bit write-heavy, as it accumulates all
the changes in tables in its own schema and then ships them to the slave
servers.

To take advantage of the fact that you multiple database servers, Zotonic
would need to be able to write to the master server and read from all the
servers (master and slaves). I don't think it can do that yet.

I probably shouldn't even mention it, but make sure that all the tables have
primary indexes. Slony will not be able to replicate a table without that.
Regrettably, I've seen several cases of people not using primary keys as an
"optimization" to avoid the cost of the primary key index (when dealing with
very large tables every byte counts). Slony can compensate that by adding
its own primary key, but once you do that your schema and Slony become tied
at the hip.

Replication is one of the features that are made much easier (even trivial)
by several NoSQL databases (CouchDB and Riak are prime examples).

Hope this helps.

Juanjo


On Fri, Oct 14, 2011 at 11:40 AM, Barco You <barcojie@REDACTED> wrote:

> Hi Michael,
>
> Thank you very much for your great suggestion. I've been actually also
> thinking of using nginx, but dont know slony and pgpool. I will try them.
> Thank you very much!
>
> Best regards,
> Barco
> On Oct 14, 2011 5:48 PM, "Michael Connors" <connorsml@REDACTED> wrote:
>
>> Hi Barco,
>>
>> I have spent sometime thinking about this, but I have not actually needed
>> to do it yet.
>>
>> If I was attempting to do it, I would probably be using the following
>> tools.
>>
>> You could put Zotonic behind nginx and use nginx as a load balancer with
>> sticky sessions, so that the user gets sent to the site that has their
>> session.
>>
>> You could replicate Postgresql using Slony so you have your database
>> distributed, and use pgpool to ensue that all writes go to the master
>> database and all reads come from the local database.
>>
>> You could replicate the images and other files using rsync.
>>
>> http://nginx.org/
>> http://slony.info/
>> http://pgpool.projects.postgresql.org/
>>
>> Michael
>>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111014/f5063e20/attachment.htm>


More information about the erlang-questions mailing list