Dear monks,

I am a Perl programmer maintaining a webapp product of a startup company. It is an online reservation system. Currently, our product is going through the transition phase. It started from a bunch of cgi scripts and ad-hoc database schema. Now it is projected to be a mature web application with a well designed module library and demanding requirements, like robustness, reliability, and availability.

As the programmer responsible for its architectural design, I have rewritten as much as 90% of its code, resulting in around 300 classes. The code is now fairly maintainable.

Now I have problem with scale. I didn't think about the scale when designing and then my class structure made the search functionality runs really slow. Search functionality is the heart of my application, so it must be quick. To fix this I made a lookup table to cache the intermediate results of the search, so that only the first search runs slow and the following ones run faster. And I also break some of the abstractions to get better performance from the class library. This solution worked.

However, nothing ever runs according to plan. Apparently, when it gets too many requests, some SELECT queries starts timing out. And also, UPDATE and INSERT queries lock the SELECT queries out of the cache table, making the search performance much worse.

I'd like to hear from other monks on how a medium or big web app application is (or should be) designed and deployed. I'd also like to hear if anyone can help me solve this scalability/speed problem. I use MySQL 4.1 on debian sarge.

English is not my native language, so aplogise for any grammatical errors. If you need me to explain more about my problem, just let me know. Thanks.

badaiaqrandista

Update: Thanks for all the replies guys. I guess I definitely have to modify the database structure to be more suitable for data retrieval and speed. I also have to split the 'search cache' table to hold different types of data, static and dynamic. Furthermore, I'd have to optimize as much as possible.


In reply to OT: Scalable web application architecture by badaiaqrandista

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.