
|
View Full Version : Web Based Chat Platforms
TheKaz 07-10-2008, 11:56 PM Hey all,
I'm currently evaluating various web based chat platforms for my site and am soliciting feedback from any who might have experience. Currently, I'm using phpFreeChat which uses a AJAX/PHP architecture and I'm finding that it's scaling very poorly. I usually get a ton of users visiting my site at a specific time of day and logging onto chat rooms for roughly 90 minutes. Outside of that window my time, my site hums along perfectly. During that 90 minute, however, my site's performance is atrocious.
I did a little digging, and most people seem to suggest that AJAX/PHP is not a very efficient architecture for web chat (and my experience leads me to agree!). So I guess my question is where do I go from here? Do I look to host an IRC server and have a web-based Java IRC client connect to that server on my site? Are there any other web-based solutions out there?
Ideally I would like some control over configuring the server (e.g. predefining everyone's nick name).
So I guess my requirements succinctly are:
- Scalable web based chat client that can be dropped onto an existing web page
- Ability to assign user to a channel based on user profile data
Any thoughts or suggestions?
---edit: Just want to add that the volume of users we're looking at chatting on the site right now is roughly 300 dispersed across 50 channels or so.
tinkertim 07-11-2008, 02:27 AM I haven't found anything with all of the stuff that you want, I've been looking for something similar to add chat into a development community portal I'm tinkering with.
I found lace (http://socket7.net/lace/) which is very lightweight and easy to modify, you'd need to do quite a bit of work to it in order to get reserved nics, kicks, superuser menus etc.
It surely won't solve all of your needs, but might save you some time when making something that does.
The Universes 07-11-2008, 03:09 AM Is your server optimized? I agree that a php + ajax or flash solution isn't very fast, but it can work if it's optimized correctly.
I've used FlashChat (tufat.com) in the past and it works ok with about 100 users after its optimized and caching is turned on.
TheKaz 07-11-2008, 11:01 AM The Universe- what do you mean by "optimized"? I'm working on making a few tweaks to things as the days wear on. Last night, I just made a tweak to have the chat use tmpfs so that it writes all chat files to /dev/shm on my machine (RAM based disk space).
Hopefully that improves performance, somewhat. Anyone have any suggestions as to system specs to run a chat script, as well? Currently I'm sitting on a VPS with ~900 MB of RAM. I realize I can throw more hardware at the problem, but before doing that, I'd rather make all the optimizations I get on the server/software side.
The Universes 07-11-2008, 11:33 AM The Universe- what do you mean by "optimized"?
Apache config tweaked? PHP opcode cacher installed? MySQL qcache tweaked/enabled? etc
Is the chat software your using file based or database based with flat file cache?
TheKaz 07-11-2008, 11:42 AM Filed based right now. I wasn't sure if file-based chat or mySQL chat was better given my setup (VPS, ~900 MB Guaranteed RAM). Hopefully the file-based solution using tmpfs should work.
I probably should install a PHP accelerator next. I'm looking at using Alternative PHP Cache (APC)
The Universes 07-11-2008, 11:47 AM Use Xcache, its one of the best.
Syd_M 07-11-2008, 01:16 PM If you're going to go the IRC route and want a web-based interface, then Mibbit (http://www.mibbit.com/) may be to your liking. It's AJAX-based (I detest Flash clients), so it's fast and scales up nicely. The thing is, Mibbit is a hosted solution so you won't be able to run it on your servers, though it can be configured to connect to any IRC network, even your own if you have one. You can give it a try and see if it works for you. :)
TheKaz 07-11-2008, 07:37 PM Use Xcache, its one of the best.
Just an update- I went ahead with Xcache with these parameters:
; select low level shm/allocator scheme implemenation
xcache.shm_scheme = "mmap"
; to disable: xcache.size=0
; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
xcache.size = 24M
; set to cpu count (cat /proc/cpuinfo |grep -c processor)
xcache.count = 8
; just a hash hints, you can always store count(items) > slots
xcache.slots = 8K
; ttl of the cache item, 0=forever
xcache.ttl = 0
; interval of gc scanning expired items, 0=no scan, other values is in seconds
xcache.gc_interval = 0
; same as aboves but for variable cache
xcache.var_size = 8M
xcache.var_count = 1
xcache.var_slots = 8K
; default ttl
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300
I'll let you know how it does! Hopefully the site holds up tonight :)
The Universes 07-11-2008, 07:47 PM A small note, you can set the xcache.var_size to 0M unless you have an application that can actually use it. Its not used for caching php code.
TheKaz 07-11-2008, 08:57 PM Just noticed that The Universes. It seems to not be doing anything right now (I'm monitoring it as we speak!). Thanks for the tip!
Saeven 07-14-2008, 11:13 PM PHP can be used to develop a socket-based system, its socket programming features are great, and very analogous to how C++ handles things (probably mirrored in an upwards-bubble type of way).
We once did a project that involved a socket based chat with a "realtime" PHP daemon (not an RTC web handler through Apache). Shipping PUT commands off to a PHP handler of this type can be extremely rapid and very resource-friendly. you could even use Flash's socket capabilities to connect to such a system, we ourselves had a Java client connecting to the PHP handler.
Something to consider!
Good luck.
Alex
|