Badai Aqrandista wrote:
My app is an online hotel booking system. That part is the part where it searches availabilities through all combination of dates, number of guests, rooms, packages, allotments, pricing structures, and more.

Okay, so it's slow because it does a lot of work. How does it do this search? Is it a bunch of SQL queries, or a request to a remote server of some other kind, or an internal calculation? Is there some possible caching you can do?

I must admit there is too much to handle in one mod_perl process. But I don't know any better way to design and code it. In the future, I'll probably move that search feature to a new process, so all the combinations can be calculated in parallel.

I would probably use some sort of queue system here. I would have the mod_perl process push requests onto a queue (probably in a database) and then have a separate daemon, maybe on a different machine, do the work and return the answer. It would allow you to split the search into multiple pieces that happen in parallel, and handle them on multiple machines simultaneously. It would also separate the web request, which is fast, from the slow search request. That lets your server scale to handling many more clients at once, even though some of them are just waiting for their turn.

For a simpler version that just forks and does the search on the same machine, see this article by Randal:
http://www.stonehenge.com/merlyn/LinuxMag/col39.html

- Perrin

Reply via email to