Consider following back-end script.


    if (isset($_GET["req"])) {
        $req = $_GET["req"];

        if ($req == "delete") {
            // Very intense calculation which finally results in deletion.

        if ($req == "add") {
            // Very intense calculation which finally results in addition.

        if ($req == "modification") {
            // Very intense calculation which finally results in modification.


Let's say there's 10 people using website intensively at the same time. Does using example.php?req=modification force Apache to rerun the entire file, or does Apache cache it for better performance and ignore every other piece that does not match?

Could I use this

without performance loss relative to this:

This would help in progress indication, seperating tasks instead of bunchprocessing and requesting 3 different files.

Recommended Answers

All 7 Replies

As I understand it, the php module sits and listens to ports and creates an instance for each request. Therefore, without some sort of data caching, there should be no appreciable difference between the two methods you describe other than the overhead for traversing a directory.

Is there any other more sufficient way using PHP? You mentioned data caching, but in my case it can't quite be used, at least tutorials are not sufficient and programming the entire cache system would not be equal to headaches saved.

PHP is already pretty fast.. what is it that you are looking to do that you are having this cocern?

what is it that you are looking to do that you are having this cocern?

I don't like the idea of reloading the same exact file about 6 times because of 6 seperate functions. I'd rather call a certain part out of it, to spare headache for the server. On top of it, I need to learn optimization.

I don't like the idea of loading 6 different files, because they all depend on each other, REALLY heavily. Of course I could use include() but that will bring me back to 1st concern and multiply it by 5!.

Well... that's a design consideration... if you want a light weight landing page for quick scripts, then make one. Im not sure what heavy weight stuff you are going to be doing, but if it's a database lookup, or processing data in some way, it should be very fast. If you want to break up your pages into a recieve and process structure, that's fine too - you can use cURL at the end of the recieve script, send it off to a processing page, and be done with it. You can also spawn threads and let them take care of it as time permits, and set up a queue.

Again, depending on what you are doing, and how much work really needs to be done, you may be trying to over-optimize before optimization is a problem :-/

It seems that you are talking about actions and you use get. Don't. Of course post can be panipulated also , but it is the first barrier (out of many many more).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.