Quote from support:
I'm not holding my breath...This problem should not come back.
i never said we need to close connection everytime
this is the proper way to do so , as well as i dont know what eaxct solution for this. am trying to help.
sory 4 misguide.
Yeah, it's easy to say you meant something else when no one understands what you write in the first place.
luckily i didnt hold my breath. almost lasted a day. now its down again. and if im not loosing connectivity because of the database, then http goes down.
it is rediculous. I am so sick of shared hosts, and all their empty promises. i want to go to a dedicated server, but i cant afford it.
in case you were wondering, the host is site5.
also, just out of interest, the boast over 200 000 clients. they have 57 servers listed here: http://www.site5.com/support/uptime.php
you do the maths (also, each client can have 5 'real websites' - and that's not including resellers).
If you have a full time broadband connection just run your own.Originally Posted by toasti
I would, but i live in south africa, and we have the most expensive bandwidth in the world, plus quite limiting on most of our connections. unfortunately its not really an option
...we also have a weak currency which makes things more expensive to
ok..what can i make of this now?
all processes are up.
port monitoring says it is up
i can ping and tracert the server
but i cant access my page from a browser (just get cached content).
they say they have not suspended the site
Delete your cache and reload the page and see what you get.Originally Posted by toasti
Also doesn't PHP automaticly close MySQL connections when the script has finished - I still recommend you use some kind of command to close the connection as well.
i have already recommend to close the connection.
MySQL settings, many concurrent users.
I run a site for a client that has over 3000 users that log in for about 5-7 hours
per day each. So, at peak times, we have to handle about 2000 concurrent users.
When configured correctly, PHP and MySQL can handle this load wonderfully on fairly
cheap Intel architecture. First off, hardware.
1) It is better to have 2 separate servers for Apache/PHP and MySQL with the Linux of your choice.
2) Try not to run too much else on either box; leave the resources for Apache/PHP and MySQL.
Here are the specs on each box in my config:
1) Apache/PHP: Pentium 3, 600 MHZ, 512 megs ram.
2) MySQL: Dual Pentium 3, 750 MHZ (1500 MHZ total), 2 gigs ram.
The reason for this configuration is that it is very database heavy;
it is a members only web site with username and password required for login, fully personalized.
It is an online school, so each student has their suite of tools for attending school,
their courses, report cards, time logging, and much more. Teachers have web based tools to create
their courses, including lessons, text to speech audio, and more.
1) PHP coding: be sure to use persistent connections!
Opening and closing a connection from your Apache/PHP box to your MySQL box is a very heavy load.
By using persistent connections, a high capacity site will open connections and share them to
exchange data rather than opening a connection on each page request, sending the data, then closing,
and repeating that process at least once for every user click!
Be sure to use "mysql_pconnect" instead of "mysql_connect" and also that appropriate changes are made
in "php.ini" or overridden by using the command "ini_set".
You can find more documentation on doing this at the php web site.
2) Apache set up ("httpd.conf"): I've changed these various settings, and played with them until they
seem to keep the most "idle %" reported in "top".
3) Mysql set up ("my.cnf"). The MySQL config file, my.cnf.
Here is what to add under the [mysqld] heading.
The two lines, "max_connections" and "max_user_connections" are where the magic happens.
Since your Apache/PHP box is connecting to MySQL, it appears as a single user.
MySQL defaults to 1 max connection, with 1 max connection per user. The following lines make
it so your Apache/PHP box can connect to your MySQL box up to the number you have set "MaxClients"
to in the Apache config above. By using persistent connections, you can pretty much get Apache up,
have it connect to MySQL upon start up, and just use the persistent connections to pass data between
the two boxes rather than opening connections. Its much more efficient that way.
set-variable = max_connections = 300
(this must be higher than "MaxClients" set in Apache, or you won't fully maximize use)
set-variable = max_user_connections = 300
set-variable = table_cache=1200
(max number of tables in join multiplied by max_user_connections)
A few other MySQL tunings:
set-variable = max_allowed_packet=1M (sanity check to stop runaway queries)
set-variable = max_connect_errors=999999
(stop mysqld from shutting down if there are connect errors - this defaults to 1 error and mysqld stops!)
hi bitbytes. Thanks for the reply. I think the the mysql_pconnect thing is not good advice though. most resources are telling me that that is prob the cause of all my problems (even though i am not using persistant connections).
Unfortunately, all the stuff you have told me about configuring my server is not use, cause i am on a shared host and clearly dont have access to those resources.
I have re-examined my stats, and looking at them, i have prob just outgrown shared hosting. i had another site which had similar problems (which is now hosted on a VPS), so i was comparing. that site got 3000 visits a day, whereas this one only gets 3-400 visits, so i thought i had a way to go before i needed to worry about moving. BUT: what i neglected was that this site gets 20 pageviews / visit, compared to the 3 which the other site was getting. So the traffic is fairly comparable.
As i mentioned before, i cant afford a dedicated host, so been searching franticly for something. found some nice looking VPS solutions at rackforce (looks a little like a cheap knockoff of rackspace...).
Has anyone any experience with them? u reckon that could solve my problems?
Broadband can also mean 128kbit upstream, which certainly is not suited for hosting a webserver.Originally Posted by bokehman
And as I have already told you, this is not necessary. Read my post again if you want to know why.Originally Posted by bitbytes
And did you just copy and paste that post from another source or something? Because it's so irrelevant that it's sad. His MySQL server says it's refusing connections because there are too many connections, so if he had his own server he would just change that setting, now wouldn't he?
Using persistent connections is just as counterproductive, but I'm not going to repeat my former post.
Certainly, because then you can just change the settings. However, be cautious when it comes to VPS solutions. Some hosts overload their servers with accounts, essentially crippling every account on it.Originally Posted by toasti
I've successfully hosted a webserver over a 128kbs connection and currently am using a 300kbs connection for all the links in my signature as well as many others. I am currently serving about 10,000 pages a day (65,000 hits) and no one has every complained about the speed yet.Originally Posted by Icheb
Certainly, because then you can just change the settings. However, be cautious when it comes to VPS solutions. Some hosts overload their servers with accounts, essentially crippling every account on it.is that accounts per host? does 12 sounds about right? its a 2.8 Xeon...VEs per Physical Host: 12
Also 200 min gaurenteed RAM. is that enough? ...how much would one be getting on a typical shared host?
He thinks that he is the smartest person in this forum.Originally Posted by Icheb
Broadband can also mean 128kbit upstream, which certainly is not suited for hosting a webserver.
128kbit/s is suitable for email, surfing the web and online text based conferencing. It is just about usable for voice over IP, but inadequate for IP based videoconferencing.
can someone explain this to me?
by http includes does he mean <?php require_once(); ?>?It looks like your site is dependant on http includes in PHP, and these were disabled on your account via a firewall rule.
If you're using a lot of http includes, and receiving a fair amount of traffic, this can be blocked because it looks like hundreds of connections from a single IP.
If possible, you shouldn't use http includes.
ok...asked him what he meant. here is the reply:
Do you think that http includes might cause one to open more database connections? perhaps they load up the included page in a seperate thread or something.What you just did was a filesystem include (i said: require_once('file.php')), not an http include. There are absolutely no problems with filesystem includes.
An http include would actually include the file over http. include("http://example.com/file.php");
I found one http include for a form on my left-side column, so that would have been included on every page. which would make sense.
..well once they fixed (probably temporarily -> time will tell), the db problem. they then made my site unavailable by firewalling it...Originally Posted by bokehman
I was just wondering if http includes might work differently to normal file includes in PHP so that http included files did open new connections. i doubt it though.
It's not me who is writing irrelevant posts all the time. I am merely the person who is disagreeing with these posts of you, so stop accusing me of thinking that I am the smartest person here if you can't back that up.Originally Posted by bitbytes
Sure, a site with relatively low traffic is fine for 128kbps. But you only need three or more people in the evening to open a page at the same time and the speed of each one of them will go down. Offering larger images or even downloads would make 128kpbs totally unfeasible for websites.Originally Posted by bokehman
With http includes they mean using include() on a file which is located on a remote server. There is no difference when it comes to MySQL connections between include('bla'); or include('http://yoursite.com/bla'); if both pages are on your server.Originally Posted by toasti
bitbytes recommended using persistent connections when the MySQL server is a physically separate machine to your web server. The latency involved in connecting is greater because it's over a network.
It doesn't mean permanent connections are right for a single-server site.
Hosting a web server at home isn't very sensible (the reasons have been covered in the web hosting forum many many times but to reiterate - bandwidth, latency, hardware and 24/7 energy costs, security, 24/7/365 service, consistency are all negatively affected by hosting at home. It's actually more expensive than most normal shared hosting once you factor in all costs).
If you're unable to use a better host (the simple solution) then you may be able to implement a cache system with any data that doesn't update too frequently to avoid performing a query.
Get age of cache file, If still fresh - load and use data, else perform query and write new data.
This way you can decimate the amount of queries made albeit with increased file access overhead.
CEO of Site5 Web Hosting - 18 Locations around the world, 45,000+ happy customers!
WebPub.com - Automatic WordPress Upgrades (New Startup)