Download pertemuan6

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
DATABASE ADMINISTRATION
Pertemuan ke-6
System Performance dan Database
Performance
source :
Database Administration
the complete guide to practices and procedures
chapter 10-11
by. Craig S. Mullins
System performance
• Performa sistem akan mempengaruhi
performa db dan performa aplikasi
• Performa db akan mempengaruhi performa
aplikasi
• ba harus mengatahui sistem dan
environtment dari db
• Dba mampu menangani perubahan sistem
meski tidak harus bekerja sendiri
Figure 10-1. The tuning boxes
The Larger Environment
The Larger Environment
• DBMS bekerja dalam lingkungan yang besar
yang meliputi software dan hardware lain
• Setiap komponen harus terinstall,
dikonfigurasi dengan efektif
• DBA harus mengetahui bagaimana interaksi
DBMS dengan hardware,OS dan software
lain
• Interaksi ini meliputi :
–
–
–
–
Interaksi dengan OS
Allied agent
Hardware configuration
Disk storage dan I/O
Componen DBMS
• DBMS terdiri dari ribuan baris code aplikasi
• DBMS sangat kompleks dan membutuhkan
banyak program dalam menjalankan
fungsinya
• Setiap vendor memecah fungsi DBMS dalam
beberapa komponen
Arsitektur Oracle
• Terdiri dari 5 basic komponen
–
–
–
–
–
file structures,
memory structures,
processes,
rollback segments, and
redo logs.
• Sebuah database oracle terdiri dari phisical
structure(data files) dan logical
structure(table,index)
Oracle Arch
• Phisical structure ORACLE terdiri dari:
– Control file
– Redo log file
– Database file
• Memory Structure
– System global Area (SGA) : data cache, redo log
buffer, share pool
– Program global Area (PGA) : user and
background process,1 proses 1 PGA
– Sort area : sort, order dan grup data
Oracle Arch
• Oracle Processes
– user processes and : execute program
– Oracle processes
• Server process : relay user process dan SGA
• Background process: data management dan
proses fungsi oracle instance
–
–
–
–
–
Proses Monitor (PMON) background process
System Monitor (SMON) background process
Database writer (DBWR)
Log Writer (LGWR)
Recover (RECO)
DBMS Installation and Configuration
Issues
Types of Configuration
• DBMS dapat di konfigurasi pada saat
instalasi atau pada saat beroperasi
• Setiap instalasi memiliki nilai default
• Parameter dalam konfigurasi DBMS dapat
diganti secara :
– Dinamis
– Nondinamis
– Gabungan
: tidak butuh restart
: harus direstart
: terkadang perlu direstart
Memory usage
• Relational databases love memory
• DBMS menggunakan RAM untuk cache data
• Cost : data dari memory < data dari disk
Memory cahce : tipe cache
• Data cache digunakan untuk menghindari I/O
operation ketika data actual sedang dibaca dari
database (buffer pool)
• Procedure cache : menyimpan SQL dan struktur
program terkait
• Sort cache : digunakan untuk menyimpan hasil
sorting
– Contoh operasi yang butuh sorting : grouping,
ordering,UNION dan beberapa tipe join
• Internal structure cache : unik untuk tiap DBMS :
– Ex : database decriptor di DB2
• Database log cache (log write and log read) : untuk
rollback dan recover operations
others
• Beberapa area yang menkonsumsi memori
–
–
–
–
–
–
User connections : maintain dan manage koneksi
Devices : untuk maintain dan penggunaan device
Open databases : jumlah db yang dapat digunakan
Open objects : jumlah objek (tabel, index,dll) yang dapat digunakan
Locks : setiap lock dalam db butuh memory
Caches : beberapa macam cache
Database Logs
• Disebut juga transaction log
• Digunakan untuk ROLLBACK dan
RECOVER
Locking and Contention
• Minimalkan :
– Lock suspensions
– Timeouts
– Deadlocks
The System Catalog
• Gunakan disk terpisah untuk instalasi sistem
katalog agar memudahkan manajemen
System Monitoring
System Monitoring
• Envorontment DBMS perlu dimonitor secara kontinue
untuk mencegah penurunan performa dan terjadinya
masalah
• Beberapa DBMS menyediakan built-in monitor.
• Beberapa aplikasi monitoring performance seperti BMC
Software's PATROL or Omegamon daro Candle
Corporation dapat digunakan untuk memonitor performa
dan memberi dinamic alerti
• Performance monitor ada tidak hanya untuk DBMS tapi
untuk seluruh sistem
• DBA harus dapat menggunakan dan mengerti apa
maksud dari monitoring yang ada
• Performance monitor bertindak seperti jendela terhadap
efisiensi performance
Database Performance :
Technique for Optimizing Databases
• Fokus pada tuning dan optimasi desain, parameter
dan phisical
• Meliputi ;
–
–
–
–
–
–
–
–
–
–
–
Partitioning
Raw partitions versus file systems
Indexing
Denormalization
Clustering
Interleaving data
Free space
Compression
File placement and allocation
Page size
Reorganization
• Setiap DBMS memiliki teknik untuk optimasi
beberapa aspek tsb, dengan berbagai nama
Partitioning
• DBA menentukan bagaimana cara mapping
tiap tabel
– Single table to a single file (tidak terlalu efisien)
– Single table to multiple files (paling banyak
digunakan untuk data besar)
– Multiple tables to a single file (digunakan untuk
tabel kecil seperti lookup dan tabel kode)
• Partioning berguna untuk parallelism
Raw Partition vs. File System
• Untuk unix-based DBMS dapat memilih antara raw
partition dan file system untuk menyimpan data
• Lebih efisien menggunakan raw partition daripada
file system untuk menyimpan data di disk
Indexing
• Penggunaan index yang benar dapat
meningkatkan performa db
• Index digunakan antara lain untuk:
– Locating rows by value(s) in column(s)
– Making joins more efficient (when the index is
defined on the join columns)
– Correlating data across tables
– Aggregating data
– Sorting data to satisfy a query
• Jika tabel kecil, hindari index
Denormalization
• Lawan dari normalisasi, beberap opsi :
– Prejoined tables— when the cost of joining is prohibitive.
– Report table— when specialized critical reports are too costly to
generate.
– Mirror table— when tables are required concurrently by two types
of environments.
– Split tables— when distinct groups use different parts of a table.
– Combined tables— to consolidate one-to-one or one-to-many
relationships into a single table.
– Speed table— to support hierarchies like bill-of-materials or
reporting structures.
– Physical denormalization— to take advantage of specific DBMS
characteristics.
Clustering
• Tabel yang tercluster akan menyimpan row
phisycal secara terurut berdasar kolom
tertentu atau beberapa kolom
• Index yang tercluster akan membuat row
tabel disimpan dalam susunan ascending
berdasar index
Page Splitting
• Ketika DBMS harus melakukan proses insert
dan tidak ada space tersedia, maka harus
dibuat page baru untuk menyimpan data, ini
disebut page splitting
• Dua tipe splitting
– Normal page split
– Monotic page split
Interleaving Data
• Dapat disebut spesialisasi dari clustering
• Jika ada dua tabel sering dijoin, maka lebih
baik melakukan interleave data menjadi satu
physical structure
Free Space
• Disebut juga fill factor
• The specification of free space in a
tablespace or index can reduce the
frequency of reorganization, reduce
contention, and increase the efficiency of
insertion
• Ensure a proper amount of free space for
each database object.
Compression
• Untuk meminimalkan ukuran db
• Dapat menggunakan internal tool atau thirtd
party software
• Memiliki efek positif dan negatif
– Positif : ukuran disk kecil
– Negatif : butuh tambahan proses untuk compress
dan decompress
File Placement and Allocation
• DBA harus meminimalkan cost untuk write
and write data pada phisical disk
• Pastikan index terpisah dari data pada
penyimpanannya
Page Size (Block Size)
• The page size is used to store table rows (or
more accurately, records that contain the
row contents plus any overhead) on disk
Database Reorganization
Database Reorganization
• Semakin lama DB digunakan akan menyebabkan
penurunan performa
• Kecepatan query menurun termasuk efek
menurunnya performa
• Salah satu penyebab menurunnya performa :
database disorganisation
• Database disorganization occurs when a database's
logical and physical storage allocations contain
many scattered areas of storage that are too small,
not physically contiguous, or too disorganized to be
used productively
Penyebab disorganisasi db
•
•
•
•
•
unclustered data
Fragmentation
Row chaining or row migration
Page splits
File extents
Organized tablespace
Disorganized tablespace
Manual reorganization
Otomatic reorganized
• REORG TABLESPACE TSNAME
Summary
• If the environment where the DBMS must operate is not
performing efficiently, it is impossible for the DBMS, and
indeed any database access, to perform efficiently.
• The DBA needs to understand every DBMS configuration value
and the impact it can have on the overall performance of the
system.
• Furthermore, the DBA must control the integration of the
DBMS with the hardware on which the DBMS runs and any
allied agent software
Summary
• Applications and data are constantly changing. Users require
instant response time and 24/7 availability.
• The database structures that support these applications must
be properly maintained to ensure optimal application
performance.
• Proper database design, appropriate choice of clustering, and
reorganizing databases based on statistics help to deliver
efficient databases.
• Furthermore, DBAs can ensure database performance by
automating these processes to reduce the risk and errors
associated with manual database maintenance
Terima kasih