Will the joomla performance be affected if there is only one controller handling all the requests? [closed]

StackOverflow https://stackoverflow.com/questions/18576725

  •  27-06-2022
  •  | 
  •  

Question

The controller is responsible for responding to user actions. In the case of a web application, a user action is (generally) a page request. The controller will determine what request is being made by the user and respond appropriately by triggering the model to manipulate the data appropriately and passing the model into the view.

Source: Controller - J1.5:Developing a MVC Component/Introduction

So I was wondering, how many http requests simultaneously (json calls, xmls calls, http calls) can a single controller handle before it starts screwing the application? I could use multiple controllers, but honestly, how many requests can a single controller in joomla handle? or in other words Will the joomla performance be affected if there is one controller handling all the requests in contrast of breaking the logic into multiple controllers?

Was it helpful?

Solution

By thinking in terms of Joomla, you are just going to confuse the answer a lot, because you introduce a lot of extra factors. You could ask the same question about any PHP file, like so:

Simpler question: I have a file called script.php, how many HTTP requests can call this file at the same time.

The answer: How ever many your server can support. Making two files (script1.php and script2.php) won't necessarily improve performance at all. It likely will have some improvement though, because ever php script that is called is loaded into memory and your server only has so much memory.

The second variable would likely be processing power. So the less that the controller has to process, the less load each call would place on the server. (So for example, if you were performing a calculation on a set of data but needed to display it in three different places on the page, only calculate it once and then save it in a variable that can be used for each display.)

In all of this, though, there is no magic number for the number of requests you could handle. Even if you ran tests and told us your controller could handle 72 simultaneous connections, that is a useless number.

What you actually want to know:

So, the test you actually should run on your server is the difference between one controller and multiple controllers. This comparison takes in to account your current hardware that you run the test on and helps you optimize the code.

And honestly on that note, I'm not sure that there will be enough of a difference to matter having worked with Joomla a lot. There are probably far worse bottlenecks in your code, and would do best to focus on standard optimization practices: PHP code optimization

As one final note, I do think it is valuable to have multiple controllers, but this is more so I can remember where the different functions are and what they do over an inherent speed issue.

OTHER TIPS

Generally, the controller is instantiated once for each single request, so each controller instance handles exactly one request. How many requests can be served simultaneously, depends on the resources available (and of course consumed per thread) and will vary from environment to environment.

it depends on the server you have. Read the article below

HTTP Server Performance Tuning

http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top