370 likes | 457 Views
Somethings U should Know. What the … ?. Replication / clustering ORM i18n. What is replication?. Allows 2 or more databases to maintain state between them One server acts as a master for one or more slaves
E N D
What the … ? • Replication / clustering • ORM • i18n
What is replication? • Allows 2 or more databases to maintain state between them • One server acts as a master for one or more slaves • Slaves pull data to be replicated from server’s binary logs and execute the relevant statements locally
Master Slave Slave Slave Slaves Replication basics… • One master supports multiple slaves • Each node on the network is assigned a unique identifying number • Each slave attempts to connect to the master and fetches data to be replicated
Master Slave Client Replication basics… DATA DATA INSERT INTO … • Clients perform data modification on master server • INSERT, SELECT, DELETE, LOAD DATA
Master Slave Client Replication basics… DATA DATA Binary Log INSERT INTO … • Immediately following execution of command on master, the command is written to the local binary log • Additionally, the master records its unique ID (to prevent endless loops in circular replication scenarios) and the timestamp for use with statements which use NOW(), etc.
Master Slave Client Replication basics… DATA DATA INSERT INTO … Replication Thread INSERT INTO … Relay Log • If the slave is online, the command is transmitted to the slave in parallel (well, immediately following) to being written in the local binary log • Otherwise, when the slave next connects it will receive a list of all pending statements from the master server’s binary log • The slave’s replication IO thread stores the command in the local relay log
Master Slave Client Replication basics… DATA DATA DATA INSERT INTO … Replication Thread INSERT INTO … Relay Log • Once the data is received in the slave’s relay log, the slave SQL thread executes the command locally, bringing the slave up-to-date with the master • In MySQL 3.23, the IO and SQL threads were just one thread. In later versions this was changed to boost performance
Replication Strategies • Load balancing – single write, distributed read
Client INSERT INTO… Client INSERT INTO … Replication Strategies • Load balancing – single write, distributed read • Load balancing – circular read/write
Client Master Slave Replication Strategies • Load balancing – single write, distributed read • Load balancing – circular read/write • High availability (hot failover) DATA DATA DATA DATA DATA
Clustering != Replication • Replication is not real time • Replication by itself is not fault tolerant • No two-phase commits
Replication == Clustering • Allows you to spread your reads out over multiple hosts thus reducing your single points of failure. • Create databases for specific tasks
Object Relational Mapping • Overview • What is Object Relational Mapping? • Desired Features • ORM Approaches & Examples • Code Generation • Attributes • XML • Object Databases • Q&A
What is ORM? • ORM addresses the “impediment mismatch” • Databases – focus on rows, indexes and key-based relationships • Objects – focus on object graphs, inheritance / polymorphism and property / object-based relationships • Databases and Objects do not cleanly align
What is ORM? • ORM closes this gap • Provides a means to automatically map objects to databases and vice versa • Simple ORM focuses on single table to single class mapping • Advanced ORM focuses on logical objects that span multiple tables, with support for object caching, child property persistence, etc.
ORM Desired Features • Support for: • All types of relationships (1-1, 1-n, n-n) • Transactions • Map single object to multiple tables and vice versa • Object inheritance • Object caching
ORM Desired Features • Support for: • Optimized queries • Smart updates • Bulk inserts / updates • Performance savvy queries / loading of object graphs • Lazy Loading • Support for multiple RDBMSs • Load-time validation • GUI for management
ORM Desired Features • Support for: • Filtering queries in memory (avoid DB round-trips) • Object Query Language • Support for Composite keys • Support for various key types (autoincrement, GUID, HiLo, etc.)
ORM Approaches – Code Gen • Code Generation focuses on generating all mappings and code at design-time • Pros • Avoids black box • Often provides ability to modify / extend generations • Everything is packaged together • Normally provides GUI • Quickly up and running
ORM Approaches – Code Gen • Cons • Less flexible – changes require regeneration • Difficult to provide more complex ORM features • Tied to specific patterns / constructs • Can bloat projects
ORM Approaches – Code Gen • Examples • LLBLGen Pro • Wilson ORMapper • CodeSmith • MyGeneration • Codus
ORM Approaches – Attributes • Attributes allow you to map objects to databases within your code • Pros • Everything is packaged together • Relationships are readily apparent to coder • Compile-time validation (limited)
ORM Approaches – Attributes • Cons • Tightly coupled framework • Unable to modify mappings without modifying code and recompiling • Bloats code
ORM Approaches – Attributes • Examples • Gentle.NET (Demo) • DLinq (Demo) • ActiveRecord • Data Mapper
ORM Approaches – XML • XML mappings allow you to define object to database mappings via an external XML file • Pros • Allows for run-time modification • Normally supports the most advanced ORM capabilities • Can be coupled w/ code generation to speed development • Easier to extend / provide frameworks on top of • Loosely coupled
ORM Approaches – XML • Cons • Requires packaging of external files • No compile-time validation • More error-prone • Syntax to learn if no GUI provided
ORM Approaches – XML • Examples • OfBiz • NHibernate • Elementary
ORM Approaches – OODBMS • OODBMSs allow you to circumvent the object-relational mismatch • Pros • Easier to get up to speed and running • Stronger performance in most cases • Run-time embedding
ORM Approaches – OODBMS • Cons • Not as mature as RDBMS market (blackouts, indexing, etc.) • GUIs are very limited at this point • Only good for short-term applications
ORM Approaches – OODBMS • Examples • db4o • Matisse • Bamboo Prevalance
Internationalization in Portals and Web sites powered by Web Services Source: http://www.pricenoia.com Powered by Amazon ECS (E-commerce Web Services Suite)
Handling International Preferences of Service Consumers Airline Information Web Service
Today the enterprises are gearing to embrace service orientation at multiple tiers to address many of the challenges of adaptation, flexibility, and efficiency Multichannel Presentation Layer Business Processes Service Service Service Service Service Service Shared Business Services Integration Tier Enterprise Application Tier Resource Tier
SOA intermediaries need to negotiate locales between providers and consumers Source: Web Services Usage Internationalization Scenarios, W3C Note
Tugas ! • Buat kelompok (1 kelompok sekitar 6 orang) • Masing – masing kelompok akan mendapat tugas mengerjakan topik : • Replikasi (2 kelompok) • ORM (2 kelompok) • Penerapan internationalization (1 kelompok) • Membuat presentasi (ulasan lebih fokus ke teknologi yang spesifik) dan rekaman (mpeg,avi,dll) dari hal yang dikerjakan • Untuk replikasi dapat memanfaatkan virtual machine (vmware, virtualbox, qemu , dll) • Dipersiapkan semaksimal mungkin untuk presentasi minggu depan (dipilih secara acak)