Welcome Guest, Not a member yet? Register   Sign In
navigation sidebar: query a database, or read it from a file?
#1

[eluser]MaxPar[/eluser]
The navigation sidebar on my page is dynamic: Every time the page loads, a bunch of mysql queries are performed and data (which can be updated/changed/deleted by an admin) is read and used to generate the sidebar.

My load time for a page is around 0.3 seconds, which seems kind of slow. I was thinking about setting up my program so that it stores the fully rendered HTML in a database entry, instead of dynamically generating it every time a user loads the page. This fully rendered HTML entry would be updated every time an administrator changed some data in the database (which is done via a webform). So, instead of calling my method to turn the data into HTML every time the user reads the page, I would only call it when an admin updates data, and then I would store the HTML string in a database entry (or a file. Or is that a bad idea?)

Can anyone think of any drawbacks for this method? One thing I was concerned about was that maybe two admins will update something at the same time, and the HTML string won't be updated properly.

Does anyone have any experience or advice for this sort of thing?
#2

[eluser]Popcorn[/eluser]
Storing the cache in the database wouldn't really work. You'll benefit most from granulated caching. This is where you can cache certain parts of your code and update them automatically every hour (or time you specify).

Check out the IgnitedCode forum and do a search for "cache"
#3

[eluser]MaxPar[/eluser]
Thanks for the info. I've found some good libraries.

One other thing. In this article: http://www.haughin.com/2008/02/13/optimi...plication/

The author uses a tool to benchmark his application, and the output looks like:

Concurrency Level: 10
Time taken for tests: 6.221538 seconds
Complete requests: 1000


What is the name of the tool he is using, and where can I find it?

Duh, answered my own question. It's:

Quote:Hey guys, to answer a question….

Dan M: I’m using ‘apache benchmark’, (command: ab)

It’s a unix based benchmark tool that comes with apache. (httpd or httpd-devel packages).
#4

[eluser]Popcorn[/eluser]
You can also find it in Windows hidden in the Apache bin directory.




Theme © iAndrew 2016 - Forum software by © MyBB