Reputation: 6425
Computer reservations system or central reservation system (http://en.wikipedia.org/wiki/Computer_reservations_system) (CRS) is a computerized system used to store and retrieve information and conduct transactions related to resource booking, such as flight ticket, hotel rooms, etc.
Now, if this is an open system, means every travel agent could login to reserve, book, or cancel seats, how to make an efficient design?
How to make the reservation accurate and efficient? - accurate, means one seat could be sold only once; - efficient, means whatever kind of locking/reservation is used, it can't block the system.
Is there some "design pattern" or "best practice" or "bible books" to read?
Well, some background... this is not a student project. It's about the train booking system of a country.
Obviously each seat could only be sold once. But as millions of people are logging in at the same time, the server just can't handle it gracefully, and there are quite some delay and timeout. So now we are called for brainstorming the design. I thought all airline booking systems are facing the same problem, so how did they solve it? i guess air ticket booking systems allow reservation of a seat for a short period of time, but how do they make it efficient?
Upvotes: 2
Views: 2276
Reputation: 308958
They are conflicting requirements. You have to block to guarantee "sold only once".
Your only solution is to minimize the code that's required to block. You have to make it transactional and isolated.
I'll assume that this is a student project. You cited Wikipedia, and the world doesn't need an open reservation system. Southwest Airlines won't be abandoning their system for yours anytime soon.
Upvotes: 2