When I heard about this project a year ago, I was really excited about it. Many cluster-wide projects based on Postgres were developed very slowly, based on older (i.e. Postgres-R http://www.postgres-r.org/) or proprietary (i.e. Greenplum) versions. The features that this project hoped to achieve were ambitious, as we’ll detail in this post. And best of all – this project is based on the 9.1 Postgresql version, which is really up-to-date (at the moment of writing this post, this is the last stable version).
If you are interested in a serious project for scaling horizontally your PostgreSQL architecture, you may visit the official website at http://postgres-xc.sourceforge.net/ and take a look.
For those who are interested, there will be a tutorial at PgCon this year. As a brief overview, I will try to give you a broad idea for those who want to get involved in the project.
What Postgres-XC can do:
- Support multi-master architecture. Data nodes can contain part or all of the data of a relationship.
- Transparent view to application from any master. The application only needs to interact with the cluster through coordinators.
- Distribute/Replicate per relation (replication, round robin (by default if any unique column is specified), by hash (by default if a unique is specified), by modulo or a set to a group or node)
- Parallel transaction execution among cluster nodes.
What Postgres-XC cannot do:
- Support triggers (may be supported in future releases).
- Distribute a table with more than one parent.
Before you start:
You need to install the most recent versions of Flex and Bison. That’s important because in the last tarball, ‘./configure’ won’t raise error if they are missing, and the error will be prompted once you execute ‘make’. You will need readline-dev and zlib-dev (not mandatory but strongly recommended).
According to the documentation, Postgres-XC should be compatible with Linux platforms based upon Intel x86_64 CPU.
The documentation needs to be improved, so we advise you to try the steps directly and read the help prompted by the commands. For example, the initdb command in the documentation is incomplete, “–nodename” is mandatory in this version. This project is new and has only a few contributors to date, but we hope its community keeps growing. Most importantly, it is great that a beta release was launched earlier than we expected.
Elements of architecture
- GTM (Global Transaction Manager)
+ Realize that I say only GTM, not GTMs. Only one GTM can be the manager. For redundancy, you have GTM-Standby and to improve performance and failover GTM-Proxies.
+ The GTM serializes all the transaction processing and can limit the whole scalability if you implement it primitively. This should not be used in slow/wide networks and is recommended to involve the fewest number of switches between GTM and coordinators. The proxies reduce the iteration with the GTM and improve the performance.
+ Uses MVCC technology. That means that it will still use the same control for the concurrency as Postgres.
+ This is the first thing you will need to configure. If you set up everything in the same machine, you will need to create a separate folder for the configuration and files.
+ Interface for applications (like a Postgres backend).
+ It has its own pooler (yes, and I think this is great, avoiding more complexity in big environments).
+ Doesn’t store any data. The queries are executed in the datanodes, but…
+ … it has its own data folder (for global catalogs).
+ Stores the data.
+ It receives the petition with a GXID (Global Transaction ID) and Global Snapshot to allow requests from several coordinators.
Both Datanodes and Coordinator use their own data directory, so keep this in mind this if you are setting both up on the same machine.
Configuring several GTM-Proxies will improve the scalability, shrinking the I/O in the GTM. Plus, you can configure the GTM-Standby to avoid a SPOF of the general manager. It not only provides the GXID, it also receives the node registration (you can trace your log or check the file inside the gtm folder called register.node, it’s binary but is readable) and most importantly, it holds the snapshot of the current status of all the transactions.
Coordinators can point to all the datanodes and can point to the same datanode (as Oracle RAC, but we’re not sure if all the features included in that solution will be available for Postgres-XC). Coordinators connect to the proxies (if you have already configured them) or the main GTM.
Hope you enjoyed the read. We are preparing more cool stuff about this amazing solution, keep in touch!
Share this article
Leave a Reply