調整共享內存:
/sbin/sysctl -w kernel.shmmax=3416386150
shmmax是最大共享內存段,假如服務器上沒有別的應用并且使用raw device可以將此參數調整到物理內存的90%,如果使用file system device 的話相應調小,因為file system buffer需要開銷內存!修改后重新啟動系統。
數據庫的創建:
tempdb數據和日志分離:
USE master
Go
DISK INIT name = 'tempdbdev01', physname = '/opt/sybase/data/tempdbdev01.dat' , size = '1G',dsync = 'false'
Go
DISK INIT name = 'tempdblogdev01', physname = '/opt/sybase/data/tempdblogdev01.dat', size = '1G',dsync = 'false'
Go
ALTER DATABASE tempdb ON tempdbdev01 = '1G' LOG ON tempdblogdev01 = '1G'
Go
USE tempdb
Go
刪除tempdb上使用的master段:
EXEC sp_dropsegment 'logsegment', 'tempdb', 'master'
go
EXEC sp_dropsegment 'system', 'tempdb', 'master'
go
EXEC sp_dropsegment 'default', 'tempdb', 'master'
Go
如果已針對 tempdb 建立了設備,則只需禁用 dsyncio,但需要重新啟動 Adaptive Server:
EXEC sp_deviceattr 'tempdbdev01', 'dsync', 'false'
Go
EXEC sp_deviceattr 'tempdblogdev01', 'dsync','false'
Go
數據庫設備最好設置Direct IO,獲得的性能相信會讓你滿意。
Sybase ASE 15.0.2運行中的配置參數及調優
1、內存
sp_configure “max memory”,0,”2600M” (設置為共享內存的75%,重啟生效)
sp_configure “allocate max shared mem”,1 (啟動的時候自動分配max memory指定的最大內存)
sp_cacheconfig “default data cache”,”1300m”(設置數據緩存為max memory的一半)
sp_cacheconfig “default data cache”,”cache_partition=2″ (在SMP的環境中還有一個問題就是螺旋鎖的競爭,當用sp_sysmon觀察到資源緩存螺旋鎖爭奪超過10%時就需要分區。)
sp_poolconfig “default data cache”,”128m”,”16k” (增加一個16K I/O緩存池,解決排序等大IO操作,需要在長期觀察后才能使用性能最佳化.)
sp_configure “PRocedure cache size”,102400 (過程高速緩存,通常是Max mem20%,這里是200M)
sp_cacheconfig ‘tempdb_cache’,'200m’,'mixed’ (創建一個200M命名高速緩存tempdb_cache給temdpb使用)
sp_bindcache ‘tempdb_cache’,tempdb (將tempdb_cache綁定到tempdb)
2、CPU(默認值為1)
當服務器的CPU個數多于一個時,可以考慮多CPU進行并行處理。(并行查詢、并行dbcc、并行建立索引、并行bcp)
可根據實際CPU數來修改,若CPU>1時,一般設置為N-1。實際上OS會自動調度。
sp_configure “max online engines”,8
sp_configure “number of engines at startup”,8
sp_configure “number of worker processes”,8 (并行度*并發連接數*1.5倍)
sp_configure “max parallel degree”,1 (允許CPU并行)
3、連接數(默認數為25,可根據應用需要來修改
sp_configure “number of user connections”,600
4、鎖
sp_configure “number of locks”,100000
5、索引對像
數據庫空閑狀態下運行:sp_countmetadata “open indexes”
正常運行時運行:sp_monitorconfig “open indexes”
來確定一個最佳值,增加10%左右。
sp_configure “number of open indexes”,2000
sp_configure “number of open objects”,2000
sp_configure “number of open partitions”,1500
此外,還有一個關于OLTP的配置,大家有興趣的可以試一試:
sp_configure “optimization goal”,”allow_oltp”
新聞熱點
疑難解答