473,794 Members | 2,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connection pool

Ike
Is anyone aware of a means of connection pooling (to MySQL, say) in php?
Thanks, Ike
Jun 7 '06 #1
8 7854
Ike wrote:
Is anyone aware of a means of connection pooling (to MySQL, say) in php?
Thanks, Ike


Yes

Thanks, C
Jun 7 '06 #2
Carved in mystic runes upon the very living rock, the last words of Colin
McKinnon of comp.lang.php make plain:
Ike wrote:
Is anyone aware of a means of connection pooling (to MySQL, say) in php?
Thanks, Ike


Yes


Well, aren't you just the clever boy this evening? You must be so pleased
with yourself.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Jun 7 '06 #3
Ike wrote:
Is anyone aware of a means of connection pooling (to MySQL, say) in php?
Thanks, Ike


Making a new connection at database server using much resources like
memory and cpu.

Connection pool is a cache of database connection. Instead of making
new connection, database server reused the old connection. This method
can increase performance and use few memory.

regards,

Lorento
--
http://blogs.deshot.com
http://www.mastervb.net
http://www.groupvita.com

Jun 8 '06 #4
lorento wrote:
Ike wrote:
Is anyone aware of a means of connection pooling (to MySQL, say) in php?
Thanks, Ike
Making a new connection at database server using much resources like
memory and cpu.

Connection pool is a cache of database connection. Instead of making
new connection, database server reused the old connection. This method
can increase performance and use few memory.

regards,

Lorento


I think the OP knows what a connectionpool is and what it is for.
Ike wants to know how/if to implement one with PHP for eg mySQL.
:-)

And I do not know the answer.
I never ran into performancetrou ble that could be solved by
connectionpooli ng under PHP.

Maybe PEAR has some support for this?

Regards,
Erwin Moller

--
http://blogs.deshot.com
http://www.mastervb.net
http://www.groupvita.com


Jun 8 '06 #5
lorento wrote:
Ike wrote:
Is anyone aware of a means of connection pooling (to MySQL, say) in php?
Thanks, Ike

Making a new connection at database server using much resources like
memory and cpu.

Connection pool is a cache of database connection. Instead of making
new connection, database server reused the old connection. This method
can increase performance and use few memory.

regards,

Lorento
--
http://blogs.deshot.com
http://www.mastervb.net
http://www.groupvita.com


Making a new connection takes some cpu, that's true. But it's not a lot. Sure,
you don't have the connection overhead with a pool - but then you have the
overhead of finding a free connection in the pool.

And yes, making a new connection takes some memory. The difference is that when
you're through with the non-pooled connection the memory is released. With
pooled connections it isn't.

Pooled connections require you to keep open the maximum number of connections
you might ever need, and the system resources associated with. So if you have a
bump at lunchtime and need 50 connections, you have to have at least 50
connections around, even at 3AM when almost no one is on. With non-pooled
connections you only use the resources you need right now.

Pooling is fine if your site needs dozens of database connections per second.
Not too many websites come even close to that, though, and connection pooling
can actually hurt system performance.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 8 '06 #6
Jerry Stuckle wrote:
lorento wrote:
Ike wrote:
Is anyone aware of a means of connection pooling (to MySQL, say) in php?
Thanks, Ike

Making a new connection at database server using much resources like
memory and cpu.

Connection pool is a cache of database connection. Instead of making
new connection, database server reused the old connection. This method
can increase performance and use few memory.

regards,

Lorento
--
http://blogs.deshot.com
http://www.mastervb.net
http://www.groupvita.com


Making a new connection takes some cpu, that's true. But it's not a
lot. Sure, you don't have the connection overhead with a pool - but
then you have the overhead of finding a free connection in the pool.

And yes, making a new connection takes some memory. The difference is
that when you're through with the non-pooled connection the memory is
released. With pooled connections it isn't.

Pooled connections require you to keep open the maximum number of
connections you might ever need, and the system resources associated
with. So if you have a bump at lunchtime and need 50 connections, you
have to have at least 50 connections around, even at 3AM when almost no
one is on. With non-pooled connections you only use the resources you
need right now.

Pooling is fine if your site needs dozens of database connections per
second. Not too many websites come even close to that, though, and
connection pooling can actually hurt system performance.


In general, I agree with you Jerry, except when you say 'So if you have
a bump at lunchtime and need 50 connections, you have to have at least
50 connections around, even at 3AM when almost no one is on.'

Most of the connection pools I have dealt with have high and low water
levels (the high to prevent demand from consuming the system and the low
to specify the minimum number of active connections). The pool then
spawns new connections on an 'as needed' basis and releases them after
some timeout period. In this respect, they act like a heap manager with
garbage collection.

Searching for a free connection can be O(1) if the connections are kept
on their own free list.

Connection pools typically require some means of persisting the shared
pool across all the programs that want access to the database which
usually rules them out if php is driven via CGI.

-david-

Jun 8 '06 #7
I think it depends on the database library used. I read somewhere (but I
don't work with the combination PHP/SQL server myself) that the SQL
server library does not even have a means of more than one connection.

For MySQL, I guess you mean a "pconnect". Be aware that a MySQL session
is just like that: a session. You can connect to the server, even define
a few variables (which can come in very handy) and they exist in that
session only. If you were reusing that session, you could mess with
variables, settings or transactions set by another process.
Transactions can be a reason to open two connections from the same
script: you log errors in a table in one connection and still roll back
in another connection without loosing the error messages.

SQL server has another interpretation of "local": a local variable in
SQL server is only defined within one batch. So with SQL server,
connection pooling is less of a problem. On the contrary, SQL server is
a system where you pay for a number of concurrent connections. Just
opening another connection can be expensive in a financial sense. So it
is even designed for connection pooling.

Best regards

Ike wrote:
Is anyone aware of a means of connection pooling (to MySQL, say) in php?
Thanks, Ike

Jun 9 '06 #8
David Haynes wrote:
Jerry Stuckle wrote:
In general, I agree with you Jerry, except when you say 'So if you have
a bump at lunchtime and need 50 connections, you have to have at least
50 connections around, even at 3AM when almost no one is on.'

Most of the connection pools I have dealt with have high and low water
levels (the high to prevent demand from consuming the system and the low
to specify the minimum number of active connections). The pool then
spawns new connections on an 'as needed' basis and releases them after
some timeout period. In this respect, they act like a heap manager with
garbage collection.

Searching for a free connection can be O(1) if the connections are kept
on their own free list.

Connection pools typically require some means of persisting the shared
pool across all the programs that want access to the database which
usually rules them out if php is driven via CGI.

-david-


David,

That's true with some pools. But not with mysql. All you have available are
persistent connections. You'd have to create your own pooling mechanism.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 12 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1766
by: Mahesh D. Rane | last post by:
Hi, I am connecting to sql databse from windows C# form. when i close the form, then also the connection to databse is active. Its not allowing me to delete the database. But if i close the complete application, then databse is delete successfully. ANy solution ? Regards,
11
2438
by: pradeep_TP | last post by:
Hi all, I have a few questions that I have been wanting to ask for long. These are all related to ADO.net and specifically to conenction to database. 1) If I have opened a connection to a database through Connection.open() method, and I do not use Connection.close() method, will garbage collector collect the connection object just because i am not using it any more. 2) I am using a dataset, in which i make some modifications to the...
7
2262
by: greg | last post by:
Hi We have w2k, iis5, .NET/c# I periodically receive this message and the system freezes ++++++++++++++++++++++++++++++++++++++++++++++++++ Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in
3
10298
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database I use System.Data.Common.DBConnection and .DBCommand. How can I keep aware from connection losses (network not availeable, db-server not available...)? Are there any strategies to detect this broken connections, and how can I
3
2009
by: LRK | last post by:
I am in the process of moving an ASP.NET app from my development machine to a web server. I am getting the following error message: Message: "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached." Is this indicative of a coding problem or perhaps a setting on the server? Help is appriciated
10
3170
by: Steven Blair | last post by:
As I understand it, if I create a connection object in my application and close the connection, the next time I open a connection with the same connection string I should be using a pooled connection? Is this possible over different instances of a class. For example Instance 1 of my dll is alive and creates a connection to a Database. The class goes out of scope (I have closed the connection by this stage)
2
5127
by: RyoSaeba | last post by:
Hello, I have a problem with the session state set to Sql Server (AspNet 1.1, Windows Server 2003 on an Application Center cluster, Sql Server 2000 on another server). Sometimes, when many user are using the application, we got this error: "System.Web.HttpException: Unable to connect to SQL Server session database. ---System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the...
2
9811
by: JoeSep | last post by:
Hi! Is it correct/safe to define a connection pool in the string "sqlConnectionString" of the "sessionState" section of Web.config? - The application is developed using AspNet 1.1 in a Windows Server 2003. - The AspState DB is defined in a Sql Server 2000 DB on another server. I have added this definition to the Web.config file: <sessionState mode="SQLServer"
16
2876
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with a worker thread that would execute the db commands. The pool was fixed and all the connections were created when the db access class was instantiated. The connections remained opened during the whole execution. If a connection was not available...
20
3301
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how many connection has been used ? 2. If the maximum pool size has been reached, what happens when I call the method Open to open the connection ? Will I get an error ? MSDN says the request is queued, but will I get an error in the open method ? ...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9037
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.