Page 255 - Open Soource Technologies 304.indd
P. 255

Unit 10: Database



            For example, this stores a list of available databases in $dbs:                       Notes
            $dbs = $db->getListOf(“databases”);



            10.4.7 Transactions

            Some RDBMSs support transactions, in which a series of database changes can be committed (all
            applied at once) or rolled back (discarded, with the changes not applied to the database). For
            example, when a bank handles a money transfer, the withdrawal from one account and deposit
            into another must happen together neither should happen without the other, and there should
            be no time between the two actions. PEAR DB offers the commit ( ) and rollback( ) methods to
            help with transactions:

            $res = $db->commit(  );
            $res = $db->rollback(  );



            If you call commit( ) or rollback( ) on a database that does not support transactions, the methods
            return DB_ERROR.


                          Be sure to check your underlying database product to ensure that it supports
                          transactions.



                        Success story on big fish games triples database



                  ig Fish Games is a global leader in the online games industry and distributes
                  more games worldwide than any other online site. Within three years of its debut,
             BBigFishGames.com rocketed into the Top 10 game portals on the Web and now serves
             millions of downloads everyday.
             Their Business Challenge
             BigFishGames.com is a fast-growing website with over 25 million unique customer accounts
             and over 2.5 million visitors per month. In addition to the English site, Big Fish Games also
             offers international game portals in Japanese, German, French and Spanish. Their ever-
             growing user base is a huge boost to their business, but it also raises big challenges around
             IT capacity planning. To ensure the highest quality game experience, Big Fish Games has
             to accurately predict demand and increase bandwidth at the right time to keep a balance
             between over-utilizing the system, introducing delays and a bad user experience, and under-
             utilizing the system, resulting in a waste of capacity and money.
             Their MySQL Solution
             Big Fish Games started using MySQL as a small start-up. MySQL allowed Big Fish Games
             to quickly grow their business with lower cost and hardware requirements, and has scaled
             with the company as it has grown into an industry leader. Today, Big Fish Games deploys
             40 MySQL servers to power its popular gaming website which offers thousands of games,
             with new games introduced everyday. To achieve the scalability and reliability required
             by this high-trafficked website, Big Fish Games relies on MySQL Replication plus, DRBD
             is used to improve high availability. In addition to customer-facing material such as the
             dynamic website content, e-commerce store, game coupons and discussion forums, the
                                                                               Contd...


                                             LOVELY PROFESSIONAL UNIVERSITY                                   249
   250   251   252   253   254   255   256   257   258   259   260