I am developing a website which I believe will grow exponentially.
Being very simplistic one needs to consider bandwidth usage and speed when developing a website. I am concerned because I have little experience in this area, and so although I know the website can handle ten simultaneous users I dont know if it can handle 100 or even 1000.
I’d rather prevent the problem as opposed to cure it if it happens so was looking for any advice/information on the subject/answers to the following specific queries.
If I have a products table, with a categories column. I then search the products table for all items with the category ‘FOOD’ – is this preferable to having a categories table with a column containing the IDs of the products which are contained within?
With Codeigniter what are the cons of calling other models from a model?
With javascript(using jquery) I want to have an auto refreshing div which contains notifications (from a db table). As far as I can tell there is no way to do this other than to do exactly that – reload the div every x seconds.. with 1000 users, reloading a div every 10 seconds I can see things getting very resource intensive. Surely facebook etc must do something like this..? How does one achieve this effectively?
Many Thanks
Thomas
It depends on your indexing on the table. If you know the id associated to
foodand you dont have to lookup that information then integer is faster IIRC.There are several ways to go about this, one is to use sockets and push the notifications to the users.. see http://pusher.com
There is also the ability to use jQuery and
$.ajaxon a timer to refresh every x seconds to a controller/action through CI… e.g;and lastly you could load all of the notifications on pageload, and display them one at a time every x seconds.
The first and last options are probably the least resource intensive.
The first because you are only querying and pushing when changes occur. The second because youre only loading the notifications once per pageload, instead of every x seconds no matter what.