![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
"The developers agree that multiple processes provide more benefits (mostly in stability and robustness) than costs (more connection startup costs). The startup costs are easily overcome by using connection pooling. " Please explain why it is more stable and robust? |
|
"Also, each query can only use one processor; a single query can't be executed in parallel across many CPUs. However, several queries running concurrently will be spread across the available CPUs." And it is because of the PostgreSQL process architecture that a query can't be executed by many CPU:s right? |
|
Also, MySQL has a library for embedded aplications, the say: "We also provide MySQL Server as an embedded multi-threaded library that you can link into your application to get a smaller, faster, easier-to-manage product." Do PostgreSQL offer anything similar? |
#3
| |||
| |||
|
|
Hello! I have a couple of final ( I hope, for your sake ) questions regarding PostgreSQL. I understand PostgreSQL uses processes rather than threads. I found this statement in the archives: "The developers agree that multiple processes provide more benefits (mostly in stability and robustness) than costs (more connection startup costs). The startup costs are easily overcome by using connection pooling. " Please explain why it is more stable and robust? More from the above statement: |
|
"Also, each query can only use one processor; a single query can't be executed in parallel across many CPUs. However, several queries running concurrently will be spread across the available CPUs." And it is because of the PostgreSQL process architecture that a query can't be executed by many CPU:s right? Although I wonder if this is the case in MySQL. It only says in their manual that each connection is a thread. |
|
Also, MySQL has a library for embedded aplications, the say: "We also provide MySQL Server as an embedded multi-threaded library that you can link into your application to get a smaller, faster, easier-to-manage product." Do PostgreSQL offer anything similar? |
#4
| |||
| |||
|
|
I understand PostgreSQL uses processes rather than threads. I found this statement in the archives: "The developers agree that multiple processes provide more benefits (mostly in stability and robustness) than costs (more connection startup costs). The startup costs are easily overcome by using connection pooling." Please explain why it is more stable and robust? |
|
"Also, each query can only use one processor; a single query can't be executed in parallel across many CPUs. However, several queries running concurrently will be spread across the available CPUs." And it is because of the PostgreSQL process architecture that a query can't be executed by many CPU:s right? Although I wonder if this is the case in MySQL. It only says in their manual that each connection is a thread. |
#5
| ||||
| ||||
|
|
On some operating systems, like Windows and Solaris, processes are expensive, while threads are cheap, so to speak. this is not the case in Linux or BSD, where the differences are much smaller, and the multi-process design suffers no great disadvantage. |
|
Actually, if it were converted to multi-threaded tomorrow, it would still be true, because the postgresql engine isn't designed to split off queries into constituent parts to be executed by seperate threads or processes. Conversely, if one wished to implement it, one could likely patch postgresql to break up parts of queries to different child processes of the current child process (grand child processes so to speak) that would allow a query to hit multiple CPUs. |
|
"We also provide MySQL Server as an embedded multi-threaded library that you can link into your application to get a smaller, faster, easier-to-manage product." Do PostgreSQL offer anything similar? |
|
pick PostgreSQL, it's generally considered a bad thing to have a database crash mid transaction. PostgreSQL is more robust about crash recovery, but still... That's another subject that shows up every x months, an embedded version of PostgreSQL. Basically, the suggestion is to use something like SQLlite, which is built to be embedded, and therefore has a much lower footprint than PostgreSQL could ever hope to achieve. No one wants their embedded library using up gobs of RAM and disk space when it's just handling one thread / process doing one thing. It's like delivering Pizzas with a Ferrari, you could do it, it just eouldn't make a lot of sense. ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org |
#6
| |||
| |||
|
|
Two: If a single process in a multi-process application crashes, that process alone dies. The buffer is flushed, and all the other child processes continue happily along. In a multi-threaded environment, when one thread dies, they all die. |
#7
| |||
| |||
|
|
Two: If a single process in a multi-process application crashes, that process alone dies. The buffer is flushed, and all the other child processes continue happily along. In a multi-threaded environment, when one thread dies, they all die. So this means that if a single connection thread dies in MySQL, all connections die? Seems rather serious. I am doubtful that is how they have implemented it. |
|
Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a tool for doing 5% of the work and then sitting around waiting for someone else to do the other 95% so you can sue them. |
#8
| |||
| |||
|
|
Two: If a single process in a multi-process application crashes, that process alone dies. The buffer is flushed, and all the other child processes continue happily along. In a multi-threaded environment, when one thread dies, they all die. So this means that if a single connection thread dies in MySQL, all connections die? Seems rather serious. I am doubtful that is how they have implemented it. That all depends on how you define crash. If a thread causes an |
#9
| |||
| |||
|
|
... Signals are shared between threads. Now, you could ofcourse catch these signals but you only have one address space shared between all the threads, so if you want to exit to get a new process image (because something is corrupted), you have to close all connections. |
#10
| |||
| |||
|
|
Right. Depending on your OS you may be able to catch a signal that would kill a thread and keep it from killing the whole process, but this still leaves you with a process memory space that may or may not be corrupted. Continuing in that situation is not cool, at least not according to the Postgres project's notions of reliable software design. There can't be any "may or may not" involved. You must of course know |
|
It should be pointed out that when we get a hard backend crash, Postgres will forcibly terminate all the backends and reinitialize; which means that in terms of letting concurrent sessions keep going, we are not any more forgiving than a single-address-space multithreaded server. The real bottom line here is that we have good prospects of confining the damage done by the failed process: it's unlikely that anything bad will happen to already-committed data on disk or that any other sessions will return wrong answers to their clients before we are able to kill them. It'd be a lot harder to say that with any assurance for a multithreaded server. I'm not sure I follow. You will be able to bring all threads of one |
![]() |
| Thread Tools | |
| Display Modes | |
| |