performance - Which caching will be faster, data as files in folders and sub folders or data as database content? -
after getting answer @andrew regan, have edited question , explanation.
i want serve html data millions. , came know - done caching.
i knew html files , have read html pages stored in databases serve.
thus question is, of following caching quicker
- caching of html files in different folders , sub folders
or
- caching of html data in database.
even if experiment done on single file / table record, method faster? (no doubt result single file or record out in nano seconds, yet, caching happen faster? e.g. either 1 procedure take 0.000000001 second , procedure take 0.000000002 seconds.
you haven't told application's architecture, or expected traffic, or whether you've considered existing frameworks solving problem. high-level view.
the answer caches.
with static content shouldn't need expose end user performance of either filesystem or database. shouldn't want anyway.
if you're serving fixed, unchanging, static content, on single server, effective option read whole lot cache (ideally held in ram, not disk) on startup , proceed there without additional loads or fetches. (even better, you'd use proven cache outside of network.)
that should extremely fast end-user. far performance on machine concerned, shouldn't make big difference how seed cache, whether filesystem or database, though disk perhaps easier work with.
you can load data lazily cache if prefer, or if have changing content. still won't matter if load disk or db provided cache aggressively enough. set long ttl (lifetime) can avoid unnecessary reloads.
Comments
Post a Comment