Welcome Guest, Not a member yet? Register   Sign In
CI + HMVC solution for large site ?


I’m starting to work on a portal on which expected unique visitors will hit around 2,00,000. Do you guys recommend CI + HMVC solution ? + What are the best practice tips.

Thanks in advance for help!

My Accreditation: I developed the software that serves over 300mbit(and growing) of files per second on 2 different servers. Every download request is run through php code totaling 1mb in mem use. Server load averages at .06 over a 48 hour span.

Best Practice for large sites with CI IMO:

1. use APC or eAccelerator, cuts execution time in half or better(in my experience)

2. if the database is not needed for every page DO NOT AUTOLOAD IT.
The DB class uses .6mb of ram and takes .05 seconds to load, very costly.
The same goes for the session class, its an extra class and at least one db query per page load

3. if using the DB, Cache everything you can. All settings, any user permission levels, anything that needs to be accessed on every page load. Just make sure you overwrite them if they change

4. do not go on an autoload spree, take the time and define what you want, where you want.

5. do not xss validate all incoming and set compress_output to false. your server should be compressing the output, not CI

6. serve static files outside of CI. do not use an assets manager that gets called for every js and css file

7. any ajax you implement that does not use the DB, do not use CI for it. create a small php file in a different folder. no need to call CI 4-5 times per page load.


Wow, Thanks for sharing such valuable information. I would appreciate if some other experts sharing similar information.

What about H-MVC module separation? Is it the best thing for H-MVC available? I feel issues in adopting this mod as version 4.2 is not compatible with 4.0. And on the site which i'm planning to work ... i can't do experiments. One way is to go through the all hmvc code and digest all logic.

@Wiredesignz can you help me on this ?


Is there a specific reason you want to do H-MVC?
For a large site it just adds processing overhead if all you want is the structure.

I feel that we might need reusable UI blocks ... and I dont want to copy same view all over.

You dont need H-MVC for that.
Just create a standard view you can personalize with settings, put it in a seperate folder in views/ like views/template/ and load it where needed. You can load views from inside other views.

Seems practical, But what about the business logic? Should I have to move those rules in class libraries so that multiple controllers can share it?

Thanks for quick reply !

PS: Please see your PM

If you are going to reuse UI elements just make wrappers for those elements and send the data to be put inside them as load->view() arguments. That way you can preformat the HTML you want inside the wrapper and just display it with no fuss.

I have just run a profiler test on a small application using the latest CI SVN on my development server. AMD64 3200+ XP, Apache, PHP5, mySQL5

It uses: 1 controller, 3 libraries, 3 models, 9 helpers, and executes 4 queries.

Results with CI alone:
Base Classes load time 0.0220
Controller execution time 0.0600
Total Execution time 0.0820

Results with ME5.1 running also:
Base Classes load time 0.0275
Controller execution time 0.0645
Total Execution time 0.0921

There is obviously a degradation in performance using ME, but I believe it offers far more advantages than disadvantages to the developer.

The choice is yours.

What'd you suggest about this issue ...
"I feel issues in adopting this mod as version 4.2 is not compatible with 4.0"

I think Benchmark is always calculated on large scale ... and graph is usually non linear rather than exponential. Can you release / recommend an optimized version ... ofcourse with some limitation rules.

- remove extra fs calls
- remove extra funtions etc ...

Please reply.

I agree with your point ... it's again upto developer.

Theme © iAndrew 2016 - Forum software by © MyBB