Jump to content

Recommended Posts

I have made a livechat system that uses ajax to call a php script every 2 seconds that runs 1 query checking a table for chat messages

 

The table will generally only have 100 messages in as I have a cron job that runs every minute to clean dead messages

 

My question is, if ajax is calling a php script every 2 seconds.. is it better to have a mysql concurrent connection, or persistant I think its called

 

If someone could advise the advantages and disadvantages of doing so.

 

I own the server so can do what I like with mysql conf etc if required. Just concerned about mysql getting hammered

 

Cheers!

Link to comment
https://forums.phpfreaks.com/topic/78935-solved-concurrent-connection/
Share on other sites

remember that you can only have X amount of connections to your server. if you dont use persistent connections it will open a connection, query, close... the chance of going of the max amount of connections in the same milisecond the query is active are slim to none.

 

Persistent connections wil make overhead from connecting smaller, but will increase the chance of getting to the max amount of connections... normal connections do not have this problem

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.