Hi people

I didn't get any answer last time i tried to ask this question.

I need a "backend" script, that make a query to a database and send the content to some users at the website.

It's because there is a very big load at the database then a lot of users looks a the website, so I would be perfect if I could do this. So the users just have to read a string from somethere? But I dont know how? Can anybody help me about this problem?

To explain the problem in steps:
1. The script make a query to a database, and takes the content out.
2. The script sends the content to all users (thats the problem, dont know how to do?)
3. A script at the user (serverside anyway, but it execute for every user), make a cleaning of the content, so only the content the user want is shown.
4. I do a loop.

Can anyone help with this?

Pleeeease ;o)

Regards,

Johan Holst Nielsen

    • [deleted]

    So what you want to do is lower the load on the servers by putting more scripts on it? :-)

    If you have a load problem then there are two things you can do
    1) buy a bigger server.
    2) change your scripts so they are more efficient with the data.

    1 is usually not possible.
    2 means makeing intelligent queries, putting indexes on the database tables,
    using pconnect instead of normal connect, etc.

    Caching data with some serverside script is much more trouble than it's worth.

    Besides, databases usually cache their queries already, so when two scripts ask the same query, the second query will get a very fast response.

      Think you misunderstod me!

      I do not make the load bigger because it put more script at the site.

      I make one script who do all database queries! (About 2 queries/sec) and not like now about 100 queries/sec.

      I just the database I want to make faster, and no, i do not think buying a new server is better. I will still give problems in the future. Just want to know solve the problem now. Isn't it possible?

      Regards,

      Johan

        • [deleted]

        It is possible, but it makes absolutely no sense.

        What you are trying to do is move the load from the database server to the webserver.

        Effectively you are trying to make a caching-databaseserver on the webserver.

        That may lighten the load on the database server, but it will seriously increase the load on your webserver.

          One script to do all the database queries (2/sec instead of 100/sec)
          Isn't it possible?

          But how can you know in advance that all 100 queries really are going to be the same as the 2 you want your backend server/cache to execute?

            because 50 users makes 2 queries == 100 qieries!

            If I could take this part out, and send it to the user without making a query everytime, would it be 2 queries instead.

            /Johan

              • [deleted]

              So your website only has two queries in it?
              Two queries that are allways the same and return the same data all the time?

              In that case, why don't you just print that data to a textfile and include() that in your site?

                That's exactly what I was leading up to. If the query is invariant, there's no real reason to use a database in the first place, or at least not as part of the end-user delivery system. Steve Yelvington has described (more than once!) a publishing system that generates static pages on demand (iirc, by having a somewhat complicated url that is parsed by a 404 handler to generate the static page the first time it's referenced.)

                  Can you please give me a link to somewhere where Steve Yelvington describe this system?

                    Write a Reply...