Postgre和Web请求 [英] Postgre and Web Request

查看:52
本文介绍了Postgre和Web请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是PostgreSQL的新用户,并且在请求率高的情况下有一些关于其

性能的问题


让图片成为一个想象的场景:

在我的系统(Debian Linux)中,

数据库中有200.000.000条记录,总数10.000个不同的用户。

(手册中说明了以下内容:有一个主要流程

称为postmaster。它为每个不同的请求启动新流程并且

每个不同的用户...我不太了解...请纠正我

如果我错了)

如果所有用户都尝试访问,通过WEB,同时数据库,

会发生什么:

1.用OS?它会崩溃吗?

2. Postmaster是否会同时启动10.000个不同的流程



3.性能怎么样?是否有任何降级评级?

4.此问题的最佳解决方案是什么?

5.邮政局长可以打开多少同时请求

没有降低性能?

Grettings,

Kilmer Cruz


------------- --------------(广播结束)---------------------------

提示8:解释分析是你的朋友

Hi,
I am a new user of PostgreSQL and there are some questions about its
performance in a scenario with a high requisition rate

Lets picture an imaginary scenario:
In my system (Debian Linux), there are 200.000.000 records on the
database, and a total number of 10.000 diferent users.
(the manual stated the following: there is a main process
called postmaster. It starts new processes to each different request and
each different user ... I dont understand very well ... please correct me
if I`m wrong)
If all users try to access, through WEB, at same time the database,
what happens:
1. With the OS? Will it crash?
2. Will the Postmaster process startup 10.000 diferent processes
at the same time?
3. What about performance? Is there any peformance downgrade?
4. What is the best solution for this problem?
5. How many simultaneos requests may the Postmaster open
withouth decreasing perfomance?
Grettings,
Kilmer Cruz

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

推荐答案

(手册中说明了以下:有一个名为postmaster的主要流程。它为每个不同的请求开始新的流程和每个不同的用户...我不太了解...请纠正我
如果我我错了
如果所有用户都试图通过WEB同时访问数据库,那么会发生什么:


很可能有10,000个用户访问网站在EXACT

的同时非常不可能(指数级)。请记住,网络是

无状态,因此每个完整的请求都会被处理,然后连接终止。\\ b
终止。这意味着与postgresql的连接也将被删除(除非你使用类似连接池或持久的

连接)。

1.随着操作系统?它会崩溃吗?


见上文。事实上,如果你确实有一个情况,那么10,000

用户在同一时间访问该网站你需要一个漂亮的

大型集群来处理它...无论如何PostgreSQL。

2. Postmaster是否会同时启动10.000个不同的进程?


见上文。

3.性能怎么样?是否有任何降级?


取决于机器,但任何数据库都是如此。


4.这个问题的最佳解决方案是什么?


您要求解决一个在数据库级别上确实存在的问题。

。您需要整体规定您的硬件要求

并更深入地了解您的应用要求。就像我说的那样,b $ b表示,你的要求极不可能像你提到的那么高。


5.邮政局长可以提出多少同时请求没有降低性能吗?


取决于机器......内存,硬盘数量(不是空间,数量等等)b $ b b等等。 。


此致,


Joshua D. Drake


Grettings,
Kilmer克鲁兹

---------------------------(播出结束)--------- ------------------
提示8:解释分析是你的朋友
(the manual stated the following: there is a main process
called postmaster. It starts new processes to each different request and
each different user ... I dont understand very well ... please correct me
if I`m wrong)
If all users try to access, through WEB, at same time the database,
what happens:
Well the likelyhood of 10,000 users accessing the website at the EXACT
same time is highly unlikely (exponentially so). Remember the web is
stateless so each full request is processed and then the connection is
terminated. This means that connection to postgresql will also be
dropped (unless you use something like connection pooling or persistent
connections).
1. With the OS? Will it crash?
See above. And actually if you really did have a situation where 10,000
users accessed the site at the exact same time you would need a pretty
large cluster to handle it... regardless of PostgreSQL.
2. Will the Postmaster process startup 10.000 diferent processes
at the same time?
See above.
3. What about performance? Is there any peformance downgrade?
Depends on the machine but that would be the case with any database.

4. What is the best solution for this problem?
You are asking for a solution to a problem that doesn''t really exist at
the database level. You need to spec your hardware requirements overall
and get an firmer understaning of your application requirements. Like I
said, it is highly unlikely that your demands are as high as you mention.

5. How many simultaneos requests may the Postmaster open
withouth decreasing perfomance?

Depends on the machine... ram, amount of hard disks (not space, quantity
of disks) etc...

Sincerely,

Joshua D. Drake


Grettings,
Kilmer Cruz

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend




---- -----------------------(播出结束)---------------------- -----

提示1:订阅和取消订阅命令转到 ma ****** *@postgresql.org



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org


(手册中说明了以下内容:有一个主流程如果我错了)
如果所有用户都试图访问通过WEB,同时在数据库中,会发生什么:


那么,10,000名用户访问网站的可能性相同

相同时间极不可能(指数级)。请记住,网络是

无状态,因此每个完整的请求都会被处理,然后连接终止。\\ b
终止。这意味着与postgresql的连接也将被删除(除非你使用类似连接池或持久的

连接)。

1.随着操作系统?它会崩溃吗?


见上文。事实上,如果你确实有一个情况,那么10,000

用户在同一时间访问该网站你需要一个漂亮的

大型集群来处理它...无论如何PostgreSQL。

2. Postmaster是否会同时启动10.000个不同的进程?


见上文。

3.性能怎么样?是否有任何降级?


取决于机器,但任何数据库都是如此。


4.这个问题的最佳解决方案是什么?


您要求解决一个在数据库级别上确实存在的问题。

。您需要整体规定您的硬件要求

并更深入地了解您的应用要求。就像我说的那样,b $ b表示,你的要求极不可能像你提到的那么高。


5.邮政局长可以提出多少同时请求没有降低性能吗?


取决于机器......内存,硬盘数量(不是空间,数量等等)b $ b b等等。 。


此致,


Joshua D. Drake


Grettings,
Kilmer克鲁兹

---------------------------(播出结束)--------- ------------------
提示8:解释分析是你的朋友
(the manual stated the following: there is a main process
called postmaster. It starts new processes to each different request and
each different user ... I dont understand very well ... please correct me
if I`m wrong)
If all users try to access, through WEB, at same time the database,
what happens:
Well the likelyhood of 10,000 users accessing the website at the EXACT
same time is highly unlikely (exponentially so). Remember the web is
stateless so each full request is processed and then the connection is
terminated. This means that connection to postgresql will also be
dropped (unless you use something like connection pooling or persistent
connections).
1. With the OS? Will it crash?
See above. And actually if you really did have a situation where 10,000
users accessed the site at the exact same time you would need a pretty
large cluster to handle it... regardless of PostgreSQL.
2. Will the Postmaster process startup 10.000 diferent processes
at the same time?
See above.
3. What about performance? Is there any peformance downgrade?
Depends on the machine but that would be the case with any database.

4. What is the best solution for this problem?
You are asking for a solution to a problem that doesn''t really exist at
the database level. You need to spec your hardware requirements overall
and get an firmer understaning of your application requirements. Like I
said, it is highly unlikely that your demands are as high as you mention.

5. How many simultaneos requests may the Postmaster open
withouth decreasing perfomance?

Depends on the machine... ram, amount of hard disks (not space, quantity
of disks) etc...

Sincerely,

Joshua D. Drake


Grettings,
Kilmer Cruz

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend




---- -----------------------(播出结束)---------------------- -----

提示1:订阅和取消订阅命令转到 ma ****** *@postgresql.org



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org


Kilmer C. de Souza说:
Kilmer C. de Souza said:
我是PostgreSQL的新用户并且有一些问题在具有高请求率的场景中的性能

让图片成为一个想象的场景:
在我的系统(Debian Linux)中,有关于该事件的200,000,000条记录数据库,共有10.000个不同的用户。
(手册中说明了以下内容:有一个主要流程称为postmaster。它启动每个不同请求的新流程和每个不同的用户...我不太了解...请纠正我
如果我错了)
如果所有用户都试图访问,通过WEB,同时数据库,会发生什么:
1.用OS?它会崩溃吗?
2. Postmaster是否会同时启动10.000不同的流程?
3.性能如何?是否有任何降级评级?
4.此问题的最佳解决方案是什么?
5.邮政局长可以打开多少同时请求而不会降低性能?
I am a new user of PostgreSQL and there are some questions about its
performance in a scenario with a high requisition rate

Lets picture an imaginary scenario:
In my system (Debian Linux), there are 200.000.000 records on the
database, and a total number of 10.000 diferent users.
(the manual stated the following: there is a main process
called postmaster. It starts new processes to each different request and
each different user ... I dont understand very well ... please correct me
if I`m wrong)
If all users try to access, through WEB, at same time the
database,
what happens:
1. With the OS? Will it crash?
2. Will the Postmaster process startup 10.000 diferent
processes
at the same time?
3. What about performance? Is there any peformance downgrade?
4. What is the best solution for this problem?
5. How many simultaneos requests may the Postmaster open
withouth decreasing perfomance?



根据您的Web开发环境(java,php,.NET)等,您可以使用某种机制来提供一个

与数据库的连接。每个请求都不会打开一个新连接

(然后释放它),但是取而代之的是从池中获取连接到

使用,并在返回时将其返回池中完成。


在最近的一个java网站(我参与其中)中,每秒平均3页请求的服务价格为每个b $ b,我们只使用了一个池8个连接。

此外,一些页面请求在呈现页面之前需要多个查询来生成所有

数据。我不记得

并发用户的数量。但你明白即使是一个小池子也可以服务很多流量(如果你的SQL查询得到了很好的优化)。


我很害怕我无法回答你的具体问题,关于postgres支持多少个b / b
的模拟和主动连接;但我怀疑它受到内存和硬件的限制。
。也许其他人可以提供帮助。


John Sidney-Woollett


---------------- -----------(播出结束)---------------------------

提示6:您是否搜索了我们的列表档案?

http:// archives .postgresql.org



Depending on your web development environment (java, php, .NET) etc, you
should be able to use some mechanism that will provide a pool of
connections to the database. Each request does not open a new connection
(and then release it), but insteads gets a connection from the pool to
use, and returns it back to the pool when done.

In a recent java web website (I was involved with) which was serving on
average 3 page requests per second, we only used a pool of 8 connections.
Also some pages requests required multiple queries to generate all the
data prior to rendering the page. I can''t remember the number of
concurrent user. But you get the idea that even a small pool can service
lots of traffic (if your SQL queries are nicely optimized).

I''m afraid I cannot answer your specific questions on how many
simulatenous and active connections postgres will support; but I suspect
that it is limited by memory and hardware. Perhaps someone else can help.

John Sidney-Woollett

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


这篇关于Postgre和Web请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆