Sunday, January 15, 2012

Thoughts about Chinese Railway Online Purchase System


During the New Year of 2012, I traveled to China. During this short 10-day trip, I stopped by 5 cities;  Beijing, Shanghai, Nanjing, Guanzhou and Shenzheng. I was indeed very exited to see a lot of improvements in many areas, such as quality of service and living standards. When I landed in Pudong airport (Shanghai), the Chinese Customs and Board Control was so efficient and friendly that I immediately felt a difference from my last trip to China a few years ago. From Shanghai to Nanjing, I sat on the bullet train (Gaotie) that took a little more than an hour and traveled  about three hundred kilometers distance. What is amazing to me is that Chinese railway system is automated from ticketing to check-in. The long queue to buy tickets and crowded manual check-in is just old memories. As an IT professional, I can surely bet that those improvements are closely resulted from advancement of IT in Chinese industries.

Talking about the Chinese railway system, it is probably the largest one in the world (India is the second). Right after the New Year, the Chinese Railway Authority announced the change of ticket regulations, namely identity documents are mandatory when purchasing tickets. This requires the implementation of a few major business rules, such as one account can only be associated with one identity card, and one identity card can only buy one ticket on the same train of the same day, etc. The other change is the improvement of capability of purchasing tickets via online system. According to the Chinese media, the amount of online tickets sold reached 23.6% of total tickets sold, which is a quite achievement.

However, I was quite disappointed about two deficiencies of the Chinese railway online purchasing system. One is that you can only purchase tickets during 6:00AM to 11:00PM. The other is there were many incidents that people didn’t get tickets even after their credit cards were charged. Many Chinese people may take these deficiencies as granted and reasonable. The amount of trouble caused to people if their credit cards are charged without the tickets, would scare me. These things would damage any company’s business in the U.S. In fact, 24 by 7 and 3 to 4 nine digits (99.9% to 99.99%) availability have already become norm for mission critical business with US companies. As a result, we can see that the gaps of IT maturity exit between Chinese industries and US counterparts.

Although I am not completely sure why the window is imposed for buying the tickets from to 6:00AM to 11:00PM, it is most probably due to the limited backend batch processing and data replication/synchronization capabilities. People in China may argue that the 11:00PM to 6:00AM unavailability may not be a big deal, since it is night time and there is only one time zone across whole China. However, how about the people from other countries in different time zones such as North America or Europe to buy the tickets online? I remember that one of my previous projects was to provide improvements for a major US hotel online reservation system. This project was initiated as a result of the incident that the system was down for only 2 hours, which cost the company a few million dollars. Comparing one time of 2 hours down time with 7 hours down time daily happening to the Chinese railway online purchasing system, I am wondering how much money has been lost and will be lost due to the 7 hours unavailability daily.

In addition, it would be a joke in the US if a system would charge a credit card without delivering the ticket.  The Chinese railway online purchasing system attributed it to the 30 minutes allocated to each transaction of purchases, as per the reports from the TV news and newspapers. The 30 minutes must be the so-called session for each Web access. The expiration of a session is not new. Many platforms and Web environments are able to detect the expiration. Together with a good design, the session expiration can be easily fixed.

The success of developing any IT systems must follow well-established methods. The system development life-cycle (SDLC) should not be very new to Chinese, thinking about how fast technology has been evolved in China. However, I would like to share a few points relating to the improvement of the Chinese railway online purchasing system.

Pay Attention to Nonfunctional Requirements.

Before starting any IT projects, the project team must collect and well understand the requirements. Requirements can be distinguished into 2 categories. One is functional, the other is nonfunctional. Functional requirements specify, in general, the system behaviors or functions terms of business logics. Nonfunctional requirements state that the attributes and quality of the system, such as security, performance, operability, etc. Both are equally important to the success of the project. However, many times during the initial stage of a project, people focus more on the functional requirements, while the importance of nonfunctional requirements are not fully recognized. This is probably because the functionality of a system is more tangible and accessible than the attributes of the system.

In fact, nonfunctional requirements must be taken into account from the very beginning when designing a system. Some nonfunctional requirements should be specified quantifiably, for example, the response time or availability of the system. The cost of retrofitting these requirements onto an existing design can be easily exceeded the initial development cost. To avoid such situations, it is imperative that significant nonfunctional requirements be identified and accommodated in the earliest stages of architecture. Without defining and meeting the nonfunctional requirements, the project will deem to fail for delivering satisfied business benefits. Furthermore, many nonfunctional requirements are architecture issues, not a component design issue (high availability is one of them). This is why you must consider them as part of your architecture.

Architecture and Design

The architecture and design of an IT system are big topics that cannot be encompassed within this short discussion. From very high level, the architecture has to be determined based on the business values that the system can deliver. Architecture can be designed in terms of layers, for example, network, infrastructure, information and application architectures. A more advanced choice of architectures is Service Oriented Architecture (SOA). The primary objectives of utilizing SOA are to automate a business process and make it agile. In addition, a universal infrastructure layer such as Enterprise Service Bus (ESB) can bring many advantages. Furthermore, the data center architecture of failover is very essential for the disaster recovery of a critical system such as the Chinese railway online purchasing system.

Down to the level of design, numerous design choices and decisions must be made to maximize the efficiency and effectiveness of the system. Design principals must be kept in mind all the time. Just to name a few principals here such as; loose coupling, encapsulation, interoperability, inherent reusability and extensibility, universal accessibility, stable interface and stay with open standards. The design choice and decision can make a lot of difference for the system behavior and performance.

Back to the 30 minutes session expiration issue that the Chinese railway online purchasing system is facing (as described above), I believe that a right design, together with the choice of using capable products, should be able to fix the problem or mitigate the risks. In terms of design, the well-know ACID principal and XA protocol for distributed transactions should be followed. ACID stands for atomicity, consistency, isolation, durability, which is a set of properties that guarantee database transactions are processed reliably. ACID is not new, it has been with computer sciences for more than 30 years. Hence, it must be known to Chinese railway online project team. ACID is rather a piece of cake if a transaction is implemented within one database. However, it becomes very challenging if the transaction crosses over different systems. In the latter case, it is the case of so-called global transaction. The underlying mechnisms of the global transaction is similar to the regular transaction, either it is successful (committed) if all participants in the global transaction turn on the green light or failed (roll-back) if any one raises a red flag. In the global transaction scenario, there must be a component in charge of collecting and sending messages to all participants as well as making go or no-go decision. This component is called global transaction coordinator. Major software vendors have implemented the global transaction coordination capability, such as IBM product family.

As a conclusion, on one side I am very pleased to see many IT advances in China. On the other side, there are still many areas that must be improved further. In addition, Chinese people need to raise their standard of expectation instead of taking mediocre reality as granted. The high expectation will result in business needs and more innovations.