Performa sistem akan mempengaruhi performa db dan performa aplikasi Performa db akan mempengaruhi performa aplikasi ba harus mengatahui sistem dan environtment dari db
Download
Report
Transcript Performa sistem akan mempengaruhi performa db dan performa aplikasi Performa db akan mempengaruhi performa aplikasi ba harus mengatahui sistem dan environtment dari db
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
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
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
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)
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 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 dapat di konfigurasi pada saat instalasi
atau pada saat beroperasi
Setiap instalasi memiliki nilai default
Parameter dalam konfigurasi DBMS dapat diganti
secara :
› Dinamis
: tidak butuh restart
› Nondinamis : harus direstart
› Gabungan
: terkadang perlu direstart
Relational databases love memory
DBMS menggunakan RAM untuk cache data
Cost : data dari memory < data dari disk
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
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
Disebut juga transaction log
Digunakan untuk ROLLBACK dan RECOVER
Minimalkan :
› Lock suspensions
› Timeouts
› Deadlocks
Gunakan disk terpisah untuk instalasi sistem
katalog agar memudahkan manajemen
Environtment DBMS perlu dimonitor secara continue 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
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
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
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
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
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.
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
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
Dapat disebut spesialisasi dari clustering
Jika ada dua tabel sering dijoin, maka lebih baik
melakukan interleave data menjadi satu physical
structure
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.
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
DBA harus meminimalkan cost untuk write and
write data pada phisical disk
Pastikan index terpisah dari data pada
penyimpanannya
The page size is used to store table rows (or
more accurately, records that contain the row
contents plus any overhead) on disk
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
unclustered data
Fragmentation
Row chaining or row migration
Page splits
File extents
REORG TABLESPACE TSNAME
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
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