wood burning stoves 2.0*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes caching flights for performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "caching flights for performance" Watch "caching flights for performance" New topic
Author

caching flights for performance

vu lee
Ranch Hand

Joined: Apr 19, 2005
Posts: 189
I have seen some posted thread suggesting to caching data when searching flight. My doubt is that flight is available only if seats are available. If flights are pulled out from the cache, seats may no longer available. In this case cache won't help much or am I missing something?
Joseph Zhou
Ranch Hand

Joined: Aug 01, 2000
Posts: 129
Hi Vu,

caching flights info including its status(cancel or delay) and seats is good for search. I just wonder is there anyway to update the "in memory" version(actually only need one for each EJB container) if anything changed at DB side?
vu lee
Ranch Hand

Joined: Apr 19, 2005
Posts: 189
Joseph,
Since seats and flight status can change from one second to another, they are not good candidates to be cached. What do you think? I wonder how people cache flights.
Geoffrey Chu
Ranch Hand

Joined: Feb 25, 2004
Posts: 70
I think Orbitz (a major website) do cache their flight search results. Last time I purchased a ticket, they kept on showing me the same flights. However, when you clicked on some of them, they will tell you (in a next screen) that they were no seats available.

I guess it is a matter of how you balance your customer satisfaction. Orbitz has too many queries (most of the people just try to look for cheap tickets). So, they will cache the results to maintain the bulk of their audience happy. However, if you want to give real online experience, I would not recommend doing so.

Geoffrey


Originally posted by vu lee:
Joseph,
Since seats and flight status can change from one second to another, they are not good candidates to be cached. What do you think? I wonder how people cache flights.


Geoffrey Chu<br />----------------------<br />- SCEA<br />- IBM UML OOAD<br />- SCJP 1.4
vu lee
Ranch Hand

Joined: Apr 19, 2005
Posts: 189
I see... but in this case, an itinerary may contain many segments. If no seat available on one of these segments when user attempt to select a seat, the whole itinerary may become useless. By the way, are we focus too much on detail implementation or we are on the right track -- abstraction, high level view.
Lucy Hummel
Ranch Hand

Joined: Jul 22, 2004
Posts: 71
Hi Vu,

Caching has advantages and disadvantages. As usuall you have to decide what is more important for your case:

  • performance
  • valid data


  • Lucy
    jono
    Greenhorn

    Joined: Dec 22, 2004
    Posts: 25
    Vu,

    this one coudl do your head in

    either solution seems valid. just make a choice and stick with it. if you look at different airline companies they provide flights and search fcilities in different ways and with different levels of success. So there is no correct functional answer. Just state how you are doign it and make sure your logic is sound. It doesn't have to be the perfect functional solution, just the perfect technical solution!
    vu lee
    Ranch Hand

    Joined: Apr 19, 2005
    Posts: 189
    is there a mutual exclusive between performance and valid when caching data? I would like to have both although it does sound impossible.

    Since the requirement emphasizes on the performance, I wonder whether I can make an assumption that user may get out_of_date data or invalid segments (seat is no longer available in one of these segment). Hm... It doesn't sound right because a user may end up building many invalid itineraries.
    Joseph Zhou
    Ranch Hand

    Joined: Aug 01, 2000
    Posts: 129
    Hi Vu,

    I think we need some strategy, here is just an example:

    The entire fight catalog is not cached. The user searches it when prepare an Itinerary, the search result can be cached, with flights, segments, ... and available seats(at least one). before check out, we can re-check the selected flights/seats availability - if a flight is not there, we have no choice, if a booked seat is not there, we can suggest a similar one(if the last one booked, we have no choice too) - and start a transaction for the booking.

    The preformance will not be too bad, and the chance to ask users to restart a itinerary should be rare.
    vu lee
    Ranch Hand

    Joined: Apr 19, 2005
    Posts: 189
    Hi Joseph,
    You propose to cache flights for a single user instead of all users. The system can discard the cache when a SFSB has timed out. I think it is a viable solution. What is your opinion on using CMR to model equipment and seats?
    Joseph Zhou
    Ranch Hand

    Joined: Aug 01, 2000
    Posts: 129
    Hi Vu,

    CMR is a good stuff in J2EE, I will use it. I think customer will happy with seating maps for selected flights.
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: caching flights for performance
     
    Similar Threads
    Are Segments Virtual or Concrete ?
    Caching flights in business tier - a question
    Question about DB and booking flights
    Doubt with seats selection
    BDM - cardinality of Flight - Segment relationship