Re: hitting the limits



windandwaves wrote:
Jerry Stuckle wrote:

windandwaves wrote:

Shaun wrote:


On Sat, 29 Apr 2006 13:40:42 +1200, "windandwaves"
<winandwaves@xxxxxxxxxxxx> wrote:



Hi Folk

I am managing a site, www.friars.co.nz that seems to be hitting the
limits and I keep getting the 500 error. According to the people
from webfarm it is because my script are too demanding or not
closed properly.



Hmmm, yes, we have only about 10,000 unique visitors per month and a
relatively straight forward MySql database. However, we have shared
hosting, I think that is where the problem lies....

Thanks for your reply



Nicolaas



10K visitors a month and an 80Mb database are nothing. Any shared
host should be able to handle that, also.

If you think it's a problem, talk to your hosting company. Maybe the
server you're on is overloaded and they will move you to a less
heavily loaded server.
I'm not familiar with webfarm - but they may be right, also. For
instance, if you don't close your mysql connection, it will be closed
eventually. But the connection will hang around until the garbage
collector gets around to cleaning things up.


I will do a close database connection at the end of each script and see if it makes a difference.


And look at how efficient your code is. I've seen some pretty good
code - but I've seen some very inefficient code out there, also. And
the inefficient code will require a lot more resources.


It is so hard for me to judge if the code is efficient. Really - who knows. I know what efficient code is, but there are just so many variables. Even making changes tot the php.ini could be huge.

Each page loads about 100Kb of libaries and functions... (probably 50 - 100 functions (small ones) in total)... Does that make a difference?
I have a couple of tables in the database with over 300,000 (small) rows)... Does that make a difference?
I use a lot of session variables (i.e. I keep a log of each page visited for each person), but all of them are stored in highly optimised Mysql tables (e.g.

person ID, page ID, time
person ID, page ID, time
person ID, page ID, time
person ID, page ID, time

In the end, because it is such muddy water, it is probably cheaper to pay for a dedicated server than to spend hours optimising your code. I can do fast development and write code in such a way that it is easy to maintain.

Thanks for your reply. Much appreciated.


Nicolaas






Well, if every page is loading unnecessary functions, then yes, that will add overhead. PHP has to parse all that code. I tend to break my functions in to groups, and only load those which are necessary for the page.

The database itself isn't a problem. However, your access to the database could be inefficient. For instance, you may be doing full table scans when the appropriate index could allow an index scan. But that is all very dependent on your the RDB you're using, database layout, the actual operations you're performing on it and about a dozen other variables.

I wouldn't think session variables would have a huge effect on it, but it's also possible. However, I would also look at what you're doing. Can you get basically the same information from your Apache log?

Yes, it will take time to make it more efficient. But I think it would be worth it. And a dedicated server has its own additional overhead for maintenance.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: What would you do with 10 Man Years?
    ... >> Not to put it down, but it looks like embedded SQL similar to what ... language specific database bindings is that they ... > But if you create some wonderful mapping into a lisp ... The canonical example of inefficient code is the straightforward recursive ...
    (comp.lang.lisp)
  • Re: Temporarirly storing web form data to be inserted into Databas
    ... point in time i am saving the data in the database through a transaction. ... tables or Session variables for each form before the transaction takes place. ... then store the data in the database inbetween ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Have a data entry screen
    ... It depends on the database. ... The big problem with preventing duplicate entries is deciding what ... the same as Rothesay Avenue. ... session variables. ...
    (comp.lang.php)
  • Re: Database design ideas or templates...
    ... time I design a database of this magnitude it would help a lot if I saw ... I apreciate the intent but we have selected postgresql for the price ... serve around 20 to 30 users it will have its own dedicated server so ... What's your budget estimate, USD, net of infrastructure and workspace? ...
    (comp.databases.theory)
  • Re: How to "fetch" a certain id
    ... Bart op de grote markt wrote: ... | How can I "fetch" this id from the database.? ... As for using session variables - you're talking apples and oranges. ... Once you get the id you can place it in a session variable, store it someplace else or whatever you want. ...
    (comp.lang.php)