in reply to Re: OT: Scalable web application architecture
in thread OT: Scalable web application architecture
It is web application running on mod_perl 1 with apache 1.3. But the classes that implements business objects basically don't care if it runs under mod_perl or from command line. They only need the database with a certain schema.
How many rows exist in db tables and how complex queries are?There could be more than a million record in the cache table. The operation on the table is basically like this (in perl-like pseudocode):
sub search { my ($arrival_date, $departure_date, $number_of_guests) = @_; validate_search_cache($arrival_date, $departure_date); my @search_results = ... do SELECT query to get a list of available + room-package combination between $arrival_date and $departure date f +or $number_of_guests ... return @search_results; } sub validate_search_cache { my ($arrival_date, $departure_date) = @_; my @validated_dates = ... do SELECT query that returns a list of da +tes between $arrival_date and $departure_date having valid combinatio +ns of room-package ... my @invalid_dates = ... look for dates between $arrival_date and $d +eparture_date that doesn't exists in @validated_dates ... foreach (@invalid_dates) { initialize_search_cache($_); } } my @field_list = ( { name => 'valid_price', op => sub { ... computation to check if price valid on a certain date ... }, }, { name => 'available_room_count', op => sub { ... calculcation to get the available room count on a certain date ... }, }, ... ); sub initialize_search_cache { my ($date) = @_; my @keys; my @values; foreach (@field_list) { push @keys, $_->{name}; push @values, $_->{op}->($date); } my $sth = $dbh->prepare("INSERT INTO (".(join ',', @keys).") VALUES + (".(join ',', map "?", @values).")"; $sth->execute(@values); }
I hope that explains how the code works. The queries are mostly simple, except when doing the search for availability.
badaiaqrandista
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: OT: Scalable web application architecture
by dokkeldepper (Friar) on Dec 07, 2005 at 13:17 UTC | |
by badaiaqrandista (Pilgrim) on Dec 08, 2005 at 00:00 UTC | |
by pajout (Curate) on Dec 08, 2005 at 10:05 UTC | |
by dokkeldepper (Friar) on Dec 15, 2005 at 11:52 UTC |