Wednesday, July 22, 2009

MySQL Clustering - Technology Summary

The demo framework not only showcases the MySQL capability but also demonstrates a variety of Sun Technologies and Industry Standard Interfaces.

The implementation has been modular so that the demo can be downsized but still the features can be demonstrated.

The various components that have been utilized are listed below -

  • Hardware: Intel Quad Core Desktop with 4GB RAM
  • Virtualization: Sun VirtualBox
  • Operating Systems: Windows Vista, Windows Server 2003, Fedora Linux, OpenSolaris
  • Database: MySQL
  • Web Servers: GlassFish and Internet Information Services
  • IDEs: NetBeans and Microsoft Visual Studio
  • Web Service Layer: Java API for XML Web Services
  • Front End GUI: Java Swing, HTML, JavaScript, Visual Web Java Server Faces, Java Micro Edition, C# and ASP.NET

Download the entire project here.

MySQL Clustering - Project Approach

As per the advice of Sun Team, the project has been implemented in a staggered model as outlined below with a use case that covered a Telephone Enterprise Customer Database wherein each Customer is uniquely identified by phone number (country code + phone number) -

Database Administration

This Phase covered the Hardware Setup, Operating System Setup, and Installation of MySQL. The major focus during this phase was to setup Replication features of MySQL using two different approaches - Asynchronous and Synchronous.

Both the replication approaches were implemented against two MySQL engines - InnoDB and MyISAM.

Implementation and comprehensive testing was performed at this stage which also covered failures of databases and scalability under the available hardware configuration.

Business Logic Development

This Phase covered the business logic requirement where the stress and focus was on standard database interfaces. The demo implemented Hibernate, an ORM model and JDBC to connect to MySQL database.

The connection to the database using these technologies is achieved through a Web Services layer. CRUD functionality has been implemented using Web Services.

Graphical User Interface Development

The focus of this phase is to demonstrate how an end-user application would interact with MySQL database using the Web Service Layer. The demo implemented various client-side GUIs in the form of front-end technologies like Java Swing, Visual Web Java Server Faces (JSF), Java Micro Edition and ASP.NET.

Exhaustive test cases have been written to demonstrate the functionality covering both success and failure situations.

MySQL Clustering - Project Design

Project Goals

The goal of the project is to provide a snapshot capability for three types of audience -

  • Database Administrators - Installation, Replication and Clustering of MySQL databases both in standalone and virtualized Operating System Environments covering Windows, Linux and Solaris
  • Business Logic Developers - CRUD (Create, Retrieve, Update, Delete) operations using Web Services to interact with the MySQL database adopting JDBC and Hibernate interfaces
  • Client Side GUI Developers - Provide sample codes to access and implement data management through above Web Services. The Client interfaces are diversified covering J2ME, JSF, Java Swing, and ASP.net to demonstrate the versatility of the seamless interface to MySQL database

Project Architecture

The project as depicted below implements the Model-View-Controller (MVC) architectural pattern, with the database layer representing the model, the business logic layer representing the controller and the font-end GUI representing the view.

Tuesday, July 21, 2009

MySQL Clustering - Project Backdrop

Industry Association Program

To provide students with an exposure to industry practices and work environment, Osmania University started the Industry Association Program (IAP), as a part of the curriculum, wherein the third year students are encouraged to work in a professional organization.

As a part of IAP, we (J. Kamala Ramya, K. Laxman Bharadwaj and me) had been assigned to Sun Microsystems Inc.

Organization Profile

Sun Microsystems Inc. is a multi-national vendor of several software and hardware products. The Headquarters of Sun Microsystems is at Santa Clara, California, United States. It has branches in several countries covering APAC, America and Europe.

Its contribution to the field of hardware has been marvelous, especially with the SPARC architecture.

Sun has several software products to its credit, which include Solaris, Star Office, VirtualBox, MySQL, etc. The most significant contribution of Sun Microsystems to the field of computers and electronics has been the "Java programming language", which is widely used in several devices, which include computers and mobile phones.

Sun is a big supporter of Open Systems and is one of the major contributors of Open Source Software.

Project Identification

Our initial interactions with Sun Team was to identity a task which would benefit Sun as an organization and for us to improve capability and be industry ready after our BE course.

After evaluating various product lines and discussions with Sun Team, a decision was made in concurrence with Sun Team to focus on a Demo Framework which would showcase MySQL capabilities and how it would interface with various layers in a typical application environment.

After the $1 billion acquisition of MySQL, Sun has been actively propagating the product to its clients. It was felt that a demo framework encompassing standard frontend interfaces, standard database interfaces and standard database functionality would help the clients to make a knowledgeable assessment of the product.

The demo suite proposed was expected to cover the replication features of MySQL to demonstrate how MySQL can fit in a complete commercial application involving various layers like - Databases, Business Logic and GUI.

Globalized Solutions - Summary

For every new program that is being developed fresh, it is recommended that it should follow the MVC pattern and that it satisfies the criteria for an internationalized program. Going forward, internationalization is an unspoken requirement that every application in global markets should satisfy.

Using translation and transliteration features to the maximum reduces the requirement of a language expert and there-by obtain project profitability.

Whichever project is being worked upon, development, migration, enhancement or QA, thinking of ways to apply the concept of Globalization will improve the robustness of the application.

Database Internationalization

Besides GUI, an application has two other parts - Business Logic and Persistence. Typically the Business Logic is isolated and no language changes would be required. For globalized applications, the Persistence is typically a database like Oracle, MySQL, IBM DB2, Microsoft SQL Server etc.

The advancements in Databases Technologies have simplified the support for multi-languages. Most of the databases today support internationalization using Unicode characters. Restrictions on the languages that can be a part of the database can also be imposed. However the availability of this restriction is dependent on the DBMS being used.

Each database management system provides its own procedure to implement this multi-lingual data processing on their database but many times a language parameter setup during installation would suffice.

Translation And Transliteration

Though not directly a part of internationalization, translation and transliteration provide the basis for I18n.

Translation

Translation is the process of converting a fragment of text from one language to another language. Translation is done by either by human translators, or by translators which involve artificial intelligence. In applications where perfect translation is required, human translators are employed.

However in applications where perfection of translation is not the at-most priority, AI translators are used. Examples of such translators include, Yahoo Babel Fish and Google Translate.

Transliteration

Transliteration is the practice of transcribing a word or text written in one writing system into another writing system. In the case of I18n, this provides a method of converting the keyboard language to a desired language.

Popular sites like Orkut make use of this service to create messages in languages like Hindi, Telugu, Tamil, etc. Several services related to translations and transliterations are available on the internet. In fact, Google provides APIs to directly implement these features in our applications.

Usage

If there is an existing product where a locale change is required and it does not follow the MVC structure, the developer can use the concepts of translation and transliteration and there-by migrate the application to the required locale. The language part is then reviewed by a language expert.

Even during internationalization, the resources bundles can be created for various languages using these concepts and they can then be offered to review by a language expert. These concepts are also useful when developers are interacting with users who do not know English through mails or documents to get an initial feel of the requirements.

Support for a product can also be made cost effective where the user logs issues in native language and the person supporting can understand the issue at high level using translation concepts. Reducing the time requirement of language expert is a significant cost saving in projects as these experts charge very high.

Internationalizing Mobiles Using J2ME

Unlike desktop applications and web application, mobile applications cannot utilize resource bundles. Internationalizing mobile applications follows a slightly different approach.

In such devices, internationalization is achieved using a user-defined resource class. This class holds all the strings required by the application in various languages. Depending on the locale, the required set of strings is returned to the main application, and that application in-turn displays the locale-specific content.

Generally the resource class obtains the locale of the mobile device and returns the locale-specific set of strings to the main application. However the languages supported by the mobile-device are entirely device-dependent. So there is a huge possibility that the internationalization efforts may not be completely perceptible in all the targeted mobile devices.

Internationalizing Web Applications

There are two important ways of internationalizing Web Applications - Using Resource Bundles and Using locale specific JSP pages.

Using resource bundles

Internationalization can be achieved by using resource bundles in Web Applications like Java Server Pages with the Java Server Faces framework. In such applications, the resource bundles created are similar to those created in the desktop applications. To use these resource bundles, they are registered with the web application in the form of a JSF config file with the required XML content.

Using locale specific JSP pages

Another way to achieve internationalization is to use different sets of JSP pages for different languages. This method mainly maintains a mirror copy for each of the language and, the locale specific JSP set is sent to the client on demand. However this method would result in more number of JSP pages but would provide greater customizability.

Internationalizing Java Desktop And Console Applications

Internationalizing a Java application mainly uses the concept of resource bundles. The User-Interface code interacts with the resource bundles to extract the required information, thereby forming the User-Interface on the screen in the desired language.

The various message labels, messages in dialog boxes, button text, etc. are to be translated to make these components for a non-English speaker. So these strings are separated from the program into a central external repository. These repositories are called as resource bundles in Java. They contain the appropriate content for the text messages in various languages for the targeted locales.

These resource bundles many contain icons, pictures, actual UI elements like menus and buttons and even new window layouts, besides messages and other user-visible strings.

The resource bundles are a collection of properties files. A properties file exists for each locale targeted by the application. A properties file consists of key-value pairs. As the language changes, the key does not change, but the value changes. The components in the User-Interface code are referenced by the keys of the properties file. So as the language changes, the UI code need not be modified, the application will find the required properties file and use the corresponding value for each instance of the key in the program. The properties files of the resource bundle follow a naming convention which is of the form - bundle-name_language_country-code.

E.g. consider a file which uses a key called greeting to welcome a user
For English the properties file would contain greeting = hello
For French the properties file would contain greeting = bonjure

So whenever the programmer wishes to welcome the user, the greeting key might may be used. If the locale is set to English (United States), "hello" is displayed. Else if the locale is set to French (France), "bonjure" is displayed.

Internationalization Support In Java

The entire Java platform is internationalized. Java provides an extensive library of classes and functions to help in internationalizing programs. Built-in I18n for Java comes with support for over 70 languages. I18n support comes for free or at very little cost.

All text in a running Java program is Unicode. Unicode was a brave effort to create a single character set that included every reasonable writing system. As a result the Unicode character set has support for almost every language script used in today’s world. Using this Unicode character set, Java provides a platform for Internationalization.

In Java the primitive type char is a single Unicode character. Similarly a String is a collection of these Unicode characters. All internal processing on text assumes the text to be in Unicode format.

Globalized Solutions - Basic Application Structure

Any application can be divided into three primary components - Front End, Business Logic and Persistence.

Internationalization primarily applies to the front end GUI and back-end data persistence. Business Logic need not be modified during the localization of the application. In frameworks like MVC, Struts, Spring, the business logic is completely separated from the GUI and in such frameworks, internationalization is easily implementable.

Internationalizing Programs

An internationalized program has the following characteristics -

  • With the addition of localized data, the same executable can run worldwide
  • Textual elements, such as status messages and the GUI component labels are not hardcoded in the program. Instead they are stored outside the source code and retrieved dynamically
  • Support for new languages does not require recompilation
  • Culturally dependent data, such as dates and currencies, appear in formats that conform to the end user’s region and language
  • It can be localized quickly

Globalization Terms

The most commonly used buzz-words in the Globalization market are Globalization, Translation and Localization and Internationalization. This article demystifies these terms.

Globalization [G11n]

Globalization addresses the business issues associated with making a product global. In the globalization of high-tech products, this involves integrating localization throughout a company, after proper internationalization and product design. This also involves marketing, sales, and support in the world market.

Globalization is mainly realized at the architecture level. There are two ways of achieving globalization - Internationalization and Localization.

Translation [T9n]

Translation is the process of converting text in one language to text in another language.

Localization [L10n]

Localization involves taking a product and making it linguistically and culturally appropriate to the target locale (country, region and language) where it will be used and sold.

Localization involves two operations - Translation and Engineering. This process primarily focuses on translating the various locale-specific data, like pictures, colors, text, etc. and then making required changes in the application code to meet the requirements of the locale.

Internationalization [I18n]

Internationalization, on the other hand, is the process of generalizing a product so that it can handle multiple language and cultural conventions without the need for re-design. It guides the developers to write program code with anticipation of locale change.

Internationalization takes place at the level of program design and document development. This is achieved by the concept of resource bundles. This approach is primarily driven by MVC architectures. The focus is on separating the GUI so that the multi-language support is easily implemented while keeping the Business Logic and Persistence as standard for a variety of users. Today Internationalization capability for any solution that is being developed is a mandated requirement.

Acronym Rules

Following the standard rules for abbreviating these words, the following acronyms will be used for the above terms in the rest of the series.

Globalization - G11n
Translation - T9n
Localization - L10n
Internationalization - I18n

These acronyms are built using a simple philosophy. The acronym consists of the first letter and the last letter with the number of characters between them as a numeral.

E.g. Consider Internationalization. It starts with I, ends with n and has 18 characters between I and n. So it is abbreviated as I18n.

Application Developers And Globalized Applications

Considering the factors mentioned in the previous blog posts, it is evident that organizations will focus on people with globalized application development or management skills. Hence it is very important that the developer community is enabled with this skill.

Requirements in future could be to globalize an existing product or develop new product for a global market. The subsequent posts provide the various facets of globalized applications leveraging the skills that are already known to the developer community.

The Case For Globalized Solutions

Globalized Solutions are becoming more important today due to some of the key trends like GDP by Region, World Population Distribution and Increased Investment in Emerging Markets. This post will emphasize the effect of these trends on Globalization.

GDP by Region

Here is a graph of the world GDP distribution. As evident from the graph, though North America is the largest part, it is still only a third of the entire GDP. The other markets like European Union, Japan, China together form a large chunk of the GDP graph. People in these countries obviously don’t speak English natively. Even small percentage penetration into these markets can improve margins significantly for companies.

World Population Distribution

Here is a graph of the world population distribution. Notice how radically the ranking change from the GDP graph.

Observe that more than half of the world’s population is in Asia, where a large chunk of non-English speaking population exists. China is fully dominated by Chinese language. India is dominated by multiplicity of languages each having a potential business opportunity.

Increased Investment in Emerging Markets

Many companies are creating business units around emerging markets like China and India as they see their future business coming from these markets. There is a significant push in these countries to modernize right now and this is moving at a significant pace.

Several real-life examples can be seen like - Usage of Mobile devices, Usage of Bank ATMs etc. As one can see today ATMs in India offer solution using Local Language / English. Mobile companies are offering solutions that allow messages to be sent in different local languages.

Emerging Markets - As good as Developed Countries

Business conglomerates, similar to developed countries are evolving in emerging markets. Companies like Bharti Airtel, Vodafone, BSNL are comparable to Verizon, AT&T etc, Banks like ICICI, SBI are no smaller than Bank of America, Citibank etc. Retail channels like Reliance Fresh, Future Bazaar, etc are similar to Wal-Mart, Radio Shack etc. Similar situations exist in China. In addition many of the multinational organizations are setting up operations in emerging markets. However customer reach can increase in these markets if offerings are expanded in different local languages.

Globalized Solutions - Introduction

In order to manage the impact of economic recession and stay profitable, many software organizations today are looking at expanding their offerings beyond the traditional US markets. Emphasis on reaching customers across the globe especially those who are located in emerging markets like European Union, China, India etc. is gaining momentum. One of the main criteria in reaching to these markets is to understand their culture and deliver products in their native language. Organizations are evaluating at models and methodologies to enhance their existing and futuristic solution portfolios to cater the global audience.

Globalized Solutions - Breaking The Barriers Of Language

Many Software Organizations today are looking at expanding their product sales, solutions and services towards emerging markets. Instead of relying on only the traditional US markets essentially dominated by the English language, companies have increased their focus on expanding business in language sensitive countries like European Union, China, India etc., One of the main criteria in reaching to these markets is to understand their culture and deliver products in their native language.

In such a scenario and also in falling job markets, specialized skills become important and knowledge of Internationalization of Applications would be one such key skill. This series of blog posts provides approaches for quick learning and building this capability.

Various techniques like Translation and Internationalization are applied with respect to communication, document reading and Application Development.

Internationalization provides a mechanism of simplifying the requirement of locale-specific applications, without losing the existing big English speaking markets like US, UK, etc. Developers can leverage programming languages like Java which internally support Internationalization for various desktop, web and mobile applications.

View the entire paper here and the presentation here. Download the sample applications here.