Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

It's funny how everything goes around in circular fashion. When I started doing web development, servers didn't have much in the way of capacity, and CGIs were extremely expensive, so everything was static. Dynamic content was something reserved for a small section of the site, and generally served off a different machine (as I remember, we had some big 8-processor Sun boxes for this - heck, it was 1996).

As time went on, the software improved, more features were desired, and dynamic content started to creep into more areas of out sites. Our front-line webservers started serving quasi-dynamic content, and those 8-processor boxes went by the wayside.

Nowadays, we're almost back where we started. We have front-line webservers that do nothing except serve static HTML, though we do use mod_include SSI directives as well (something that could be done in perl). We generally don't do much in dynamic content, except for full-blown applications. And we serve a *lot* of content every day.

With all that - nothing beats static HTML in terms of performance or server response time. And the more systems/applications you add to a page, the fewer pages you're able to serve, the more your response time goes up, and the more hardware you'll need to support your site.

Things to think about:

  • Serve static HTML. If you've got dynamic components, how often do they need to update? Do they need to update on every request? If not, that's not dynamic - it's static that just needs to change often - the data can probably be written out to the filesystem and included in the page in any number of ways.
  • If you need dynamic content on every page - use HTML::Template, it's the fastest templating system for perl out there. And look into caching your templates, it will save a lot of memory in a server environment. Screw 'more powerful' templating systems - HTML::Template does anything you'll need, and it won't slow you down. I've never been in a situation where it hasn't done what I need.
  • Minimize the amount of content that needs to be re-written. If you're talking about sidebar content, don't re-write the main body at all! Save it elsewhere and slurp it in!
  • KEEP THE DB AWAY FROM THE FRONT LINE! Nothing slows a site down like hitting a database - even if you're caching your DB connections, you're talking about a whole other application that you're interacting with. Get a lot of traffic, and your DB will be holding you back.
  • If you absolutely need to hit a data store on every single page, what can you do to speed it up? Can you pre-load all the data from the DB before you start serving connections? Can you use a BerkleyDB?

I don't want to discourage you from going into dynamic website construction - it's where things get interesting. But if you're not careful, you can find yourself with a server melting down under the load, and few quick remedies. Try a few things, see what it gets you, but keep the above in mind if people start to really like what you're doing. Good luck! :)


In reply to Re: Re: pulling content from db - is it a good idea? by swngnmonk
in thread pulling content from db - is it a good idea? by kiat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-19 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found