![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| ||||
| ||||
|
|
-----Original Message----- From: pgsql-general-owner (AT) postgresql (DOT) org [mailto gsql-general-owner (AT) postgresql (DOT) org] On Behalf Of Ed L.Sent: Wednesday, November 03, 2004 5:10 PM To: pgsql-general (AT) postgresql (DOT) org Subject: [GENERAL] 24x7x365 high-volume ops ideas I have a few high-volume, fairly large clusters that I'm struggling to keep up 24x7x365. I want to ask for advice from anyone with similar experience or hard-won wisdom. Generally these are clusters with 100-200 queries/second, maybe 10GB-30GB of data (always increasing), and maybe 10% writes. A little regular routine downtime for maintenance would do wonders for these systems, but unfortunately, the requirement is 100% uptime all the time, and any downtime at all is a liability. Here are some of the issues: 1) Big tables. When the tables grow large enough, it takes too long to vacuum them. In some cases there's just too much data. In other cases, it's dead space, but both reindex and vacuum full block production queries (a lesser version of downtime). In the past, we have taken a PR hit for downtime to dump/reload (we've found it to be faster than vacuum full). Async replication helps with cluster moves from one server to another, but still don't have a low-to-zero downtime solution for regular maint. |
|
2) Big tables, part 2. Of course, customers want all data that ever existed online and quickly available via sub-second queries. I assume at some point this data is going to be too much for one table (how much is too much?). This is a little vague, I know, but what sorts of segmenting strategies to folks employ to deal with data that cannot be retired but gets too expensive to vacuum, etc. |
|
3) Simple restarts for configuration changes (shared_buffers, max_connections, etc). When we have to break client connections, we have to notify the customer and take a PR hit. Maybe pgpool is a possible solution? |
|
Are these issues for Oracle, DB2, etc as well? Yes, but not as pronounced. For instance with SQL*Server you do "UPDATE |
#3
| |||
| |||
|
|
On Wed, 2004-11-03 at 18:10, Ed L. wrote: unfortunately, the requirement is 100% uptime all the time, and any downtime at all is a liability. Here are some of the issues: Seems like 100% uptime is always an issue, but not even close to reality. I think it's unreasonable to expect a single piece of software that NEVER to be restarted. Never is a really long time. For this case, isn't replication sufficient? (FWIW, in 1 month I have to answer this same question). Would this work? * 'Main' db server up 99.78% of time * 'Replicant' up 99.78% of time (using slony, dbmirror) * When Main goes down (crisis, maintenance), Replicant answers for Main, in a read-only fashion. * When Main comes back up, any waiting writes can now happen. * Likewise, Replicant can be taken down for maint, then Main syncs to it when going back online. Is this how it's done? |
#4
| |||
| |||
|
|
On Sun, 2004-11-07 at 21:16, Christopher Browne wrote: None of these systems _directly_ address how apps would get pointed to the shifting servers. snip Something needs to be "smart enough" to point apps to the right place; that's something to think about... Seems like it would be pretty easy to be smart in PHP: function db_connect() { $conn = pg_connect("dbname='foo' user='dawg' password='HI!' host='master'"); if (!($conn AND (pg_connection_status($conn) == 0))) { // problem with master $conn = pg_connect("dbname='foo' user='dawg' password='HI!' host='replica'"); if ($conn AND (pg_connection_status($conn) == 0)) { return $conn; } } else { return $conn; } return NULL; } Whatever client-side language one uses, the technique is the same (though the coding style might differ :P ), can be used for persistent connections (eg: with pg_pconnect in PHP), and seems like it could be extended to any reasonable number of database servers. What is the problem with this? The only issue I can see is that "replica" might be behind. Depending on the application, this might not be bad. If the app MUST have the very most accurate DB, you could remove the logic that connects to the replica, but then that nullifies this whole conversation... |
#5
| |||
| |||
|
|
On Sun, 2004-11-07 at 21:16, Christopher Browne wrote: None of these systems _directly_ address how apps would get pointed to the shifting servers. snip Something needs to be "smart enough" to point apps to the right place; that's something to think about... Seems like it would be pretty easy to be smart in PHP: function db_connect() { $conn = pg_connect("dbname='foo' user='dawg' password='HI!' host='master'"); if (!($conn AND (pg_connection_status($conn) == 0))) { // problem with master $conn = pg_connect("dbname='foo' user='dawg' password='HI!' host='replica'"); if ($conn AND (pg_connection_status($conn) == 0)) { return $conn; } } else { return $conn; } return NULL; } Whatever client-side language one uses, the technique is the same (though the coding style might differ :P ), can be used for persistent connections (eg: with pg_pconnect in PHP), and seems like it could be extended to any reasonable number of database servers. What is the problem with this? The only issue I can see is that "replica" might be behind. Depending on the application, this might not be bad. If the app MUST have the very most accurate DB, you could remove the logic that connects to the replica, but then that nullifies this whole conversation... |
#6
| |||
| |||
|
|
Hi Chris and Karim, I haven't been following this thread, so excuse me if I suggest something that has already been tossed out. Solaris allows multiple IP addresses to be assigned to a single NIC. I just looked at the man page for Linux ifconfig but didn't see quickly how to do this. If Linux doesn't allow this, the same thing can be accomplished using multiple NICs per server. We reserve a special IP for the DB server. This IP can be assigned to the NIC of the machine currently hosting the database. If you want apps to connect to a different server, remove the IP from one machine and reassign it to the other. This special DB IP is assigned on top of the regular IP for the machine. Newly connecting apps are never the wiser, but existing connections must be terminated. |
#7
| |||
| |||
|
|
Hi, On Tue, 2004-11-16 at 14:17, Richard_D_Levine (AT) raytheon (DOT) com wrote: Hi Chris and Karim, I haven't been following this thread, so excuse me if I suggest something that has already been tossed out. Solaris allows multiple IP addresses to be assigned to a single NIC. I just looked at the man page for Linux ifconfig but didn't see quickly how to do this. If Linux doesn't allow this, the same thing can be accomplished using multiple NICs per server. ifconfig device:<alias> ipaddress up |
|
We reserve a special IP for the DB server. This IP can be assigned to the NIC of the machine currently hosting the database. If you want apps to connect to a different server, remove the IP from one machine and reassign it to the other. This special DB IP is assigned on top of the regular IP for the machine. Newly connecting apps are never the wiser, but existing connections must be terminated. Yes, linux can do it as well. But either case beware the arp cache :-) There is sqlrelay which could do the switching as well without forcing the apps to reconnect. Regards Tino ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org |
#8
| |||
| |||
|
|
Hi, On Tue, 2004-11-16 at 14:17, Richard_D_Levine (AT) raytheon (DOT) com wrote: Hi Chris and Karim, I haven't been following this thread, so excuse me if I suggest something that has already been tossed out. Solaris allows multiple IP addresses to be assigned to a single NIC. I just looked at the man page for Linux ifconfig but didn't see quickly how to do this. If Linux doesn't allow this, the same thing can be accomplished using multiple NICs per server. ifconfig device:<alias> ipaddress up |
|
We reserve a special IP for the DB server. This IP can be assigned to the NIC of the machine currently hosting the database. If you want apps to connect to a different server, remove the IP from one machine and reassign it to the other. This special DB IP is assigned on top of the regular IP for the machine. Newly connecting apps are never the wiser, but existing connections must be terminated. Yes, linux can do it as well. But either case beware the arp cache :-) There is sqlrelay which could do the switching as well without forcing the apps to reconnect. Regards Tino ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org |
![]() |
| Thread Tools | |
| Display Modes | |
| |