3

According to php manual:

Persistent connections are not closed at the end of the script, but are cached and re-used when another script requests a connection using the same credentials. The persistent connection cache allows you to avoid the overhead of establishing a new connection every time a script needs to talk to a database, resulting in a faster web application.

One advantage is efficiency that we do not need to make connection each time script executes. What are other advantages of persistent connection? Like query cache etc?

5
  • Mostly the disadvantages are mentioned in most articles. According to php manual :" In fact, to be extremely clear about the subject, persistent connections don't give you any functionality that wasn't possible with their non-persistent brothers."
    – waqas
    Commented Jun 16, 2017 at 6:03
  • To reduce the delay caused by establishing connectivity between two servers by preventing the connection from closing and needing to be renegotiated. Such as when connected to a distant or heavily trafficked server. Otherwise none.
    – Will B.
    Commented Jun 16, 2017 at 6:31
  • It seems that it can only be used to reduce time consumed in establishing connection. I couldn't find any other benefit.
    – waqas
    Commented Jun 16, 2017 at 7:37
  • My earlier experiences (legacy mysql extension around the mid 2000's) were awful: PHP was actually unable to reuse existing connections, God knows why, and I eventually exhaused the connection limit. I hope that the mysqli in 2017 has fixed that. In any case, unlike with other database engines, MySQL connections happen really fast so potential benefit is not as promising. Commented Jul 5, 2017 at 8:30

1 Answer 1

1

it Allows for resumption of transactions across multiple request as well as Allow connections setting such as character set encoding to persist

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.