Hi there.
I'm presently coding a chat application in php / mysql. The server I'm on has zend optimizer which is supposed to make scripts a little faster. Though I'm considering moving to a vps and installing apc or xcache.
I'm somewhat new to coding though in php and was wondering. When is a script considered big / cumbersome for execution?
Eventually, my plan would be for my site to have between 100 to 250 concurrent users at a time. This doesn't always necessarily translate to 100-250 requests per second, however, it could if they were completely active.
My chat script I set up in this way.
Login.php (html page, displays login form, directs to validate.php)
Validate.php (holds pages worth of security checks, functions, etc, before authorizing the person to continue on and build a valid session ID in the mysql database - I require all users to register to use the site)
Once logged in, the user will be at "chat.php" which builds all the variables, checks for proper session ID every "pull" of the chat, or manual refresh basically. It also checks for /commands and requires command.php (which each individual command checks sessions as well to prevent malicious executions)
Overall. My chat.php script is about 6 to 7 Kilobytes (K in size. About 200 lines of code. possibly up to 300 lines of code at the utmost, depending on the size of the /command file required if a /command is input.
on each execution of the script there are anywhere between 2 database queries minimum (displaying chat room text from one table, and checking session id from another) to a maximum of 6 database queries per run.
My script is very simple and basically just runs from top to bottom passing through a bunch of "if" statements to match up to things that could possibly happen.
based on the above, how many users do you think this sort of script could concurrently support. both just normal php and perhaps using XCACHE or another form of php cache enhancer?
I'm not super fond of iframes or javascript to push the data "live"
the chat room text consists of 20 lines displayed (20 most recent posts) and holds a total of the most recent 50 lines. So this means at the most the chat script has to go through is 50 rows of data to display chat room text wise. the user database is Nil as all the processing for it is done in validate.php and that file is only required once during login and builds the users information into variables which are cached.
how many users could I expect to support realistically at the same time all actively "chatting" with my current architecture.
how could I make it better short of something drastic like trying to figure out heap tables or innodb stuff (way beyond my scale at the moment though I've read up on them)