Welcome Guest, Not a member yet? Register   Sign In
Ajax performance question
#1

[eluser]hykoh[/eluser]
I think it would recommended to create a special .php file with only special handlers for incoming POST, isnt it ?

If CI get loaded everytime a ajax call get sent, the load goes raise unnecessary up ?

So i think $.post('/my/dir/to/some/ajaxHandler/example.php with just a few needed function is better instead of $.post('/controller/ajaxMethod');

Please post your experience =)
#2

[eluser]xwero[/eluser]
The framework has a bit of an overhead but if you start moving functionalities outside the framework the code will be more difficult to maintain.

It seems you are on a optimizing trip the last few days but optimizing isn't everything. You have to look at the whole application to find out where the bottlenecks are. It could be as simple as indexing fields in the database instead of pressing every nanosecond out of the php code.
#3

[eluser]hykoh[/eluser]
ye, but i have to handle much users and can't risk such an overhead :|
#4

[eluser]xwero[/eluser]
You should check how much overhead you actually have before you start putting every ajax request in a separate file. In tests CI scores good, in comparison with other frameworks, on handling concurrent requests.
#5

[eluser]Randy Casburn[/eluser]
I use AJAX extensively. I'm not sure what I would do without the functionality CI offers as the 'server' component in the 'client/server' pair. Without loading up CI, I don't get all the functionality it offers. So I take advantage of all that but for optimization, I dump everything via 'echo'd json_encode()'d strings as soon as possible and avoid further processing by CI. Certainly avoid the Output class as it provides no benefit unless you are returning HTML to your AJAX requests.

That said, if you wanted to 'create a special php file' because you don't need the framework's overhead...do you really need the framework at all?

Hope this is helpful,

Randy
#6

[eluser]Nick Husher[/eluser]
If you're making extensive use of AJAX, to the point where you're having server load problems, you have two real choices: improve your server architecture or rethink your AJAX usage. Eliminating CI from the system isn't really going to save you all that much.




Theme © iAndrew 2016 - Forum software by © MyBB