PDA

View Full Version : Client-side processing vs. Server-side processing


codefox
05-06-2005, 10:37 PM
I am working on a website that uses javascript extensively. The homepage is rendered using javascript files which are altered for content changes. This in a way is good since using a database would increase the number of hits to the db. But it makes it difficult when it comes to versioning. I am planning to rewrite the pages to use a database for storing content. But I am in a dilemma whether that would be as efficient as the current design since once the javascript files are brought to the user's computer they wont be retrieved again unless the content changes. Alternatively, if I use a db, everytime the user refreshes the page there would be a database hit.

I would like to have suggestions from website builders on which design is better.

- One that uses database for content
- On that uses javascript files for content (like the current one)
- A combination of both, i.e content is stored in db, but a CMS will read content from db and store them in js files every time there is a content change.

I would like to know if there is any cachine mechanism if I use a db that would reduce the no. of hits to the db everytime the user refershes/accesses the pages if there is no change to the content.

Thanks!

Basscyst
05-07-2005, 12:38 AM
Considering some users may not have JS enabled, it's not a good idea to rely on it for anything pertinent to the functionality of the site. This is where server side scripting has it's advantages. As far as limiting the calls to the database when content hasn't changed, how would you know if the data has or has not changed without checking the database anyway?

Basscyst

codefox
05-09-2005, 10:07 AM
Yes, there would be a database hit anyways, but what I would like to know is if databases have caching mechanisms that would return data from a cache if the same query is executed multiple times and there was no recent update to any of the tables accessed by the query.

mlseim
05-09-2005, 06:27 PM
I've always been under the impression that MySQL is very efficient and
multiple hits would never be a problem. A webhost that offers MySQL
would certainly have the bandwidth requirements to run it for a rather
large company?

I agree with Basscyst, go with a server-side database. I think it would
also be easier to manage from an administrator point of view.