Beruflich Dokumente
Kultur Dokumente
An overview of the current Standards for building Sybase ASE servers (Taken from Standards for Installing ASE Servers on Solaris Hosts, Mich Talebzadeh) Draft 1, December 2007
What is covered
Unix Server Configuration DBA environment Temporary database tempdb tempdb Recommendation tempdb Devices on tmpfs
4
What is covered
tempdb on file systems tempdb Configuration Devices Building Sybase ASE ASE Port Numbering Default Character set
What is covered
Location of log files Memory and Cache configuration
What is covered
Memory Configuration Cache Configuration Procedure Cache Network Packet Size Number of devices User Connections
What is covered
Maximum number of Engines Setting the number of locks interfaces file ASE Emergency bug fixes (EBF) Time Zones
8
What is covered
Environment Files RUN_${DSQUERY} file References
10
11
12
Multiple IP addresses
For H/W failure issues
13
DBA Environment
Sybase Account
sybase group : dba csh
Environment files
.login sets default server for host server specific environment.ksh to set ASE variables and paths
14
DBA Environment
Sybase home
2GB/4GB filesystem, dependant on products installed
Mounted as /export/home/sybase
15
DBA Environment
Sybase home directory structure
~/<product>/<version> ~/dba/.
../bin : main scripts for maintenance/monitoring ../etc : ../log : additional log files (debug) ../tmp : work files for ../bin scripts
16
DBA Environment
Sybase backup directory structure
Built on its own partition
/syblive/backup
../<server-name>/dbdumps : dump files ../<server-name>/txn_logs : log dumps
17
18
tempdb Recommendation
Put your tempdb devices on tmpfs or any other form of RAM disk if possible if you are using a 32-bit version of ASE (4GB max Sybase memory) and you have spare RAM. If you are using 64-bit version of ASE and your data disks are reasonably fast or you are using SAN disks with large cache, then you are advised to allocate the memory reserved for tmpfs to ASE itself.
19
tempdb Recommendation
Split the data and log in tempdb. This not only yields better performance, but allows you to measure the size of your segments in tempdb with better accuracy. Create a private cache for tempdb with appropriate buffer pools. You may decide to split the tempdb caches into tempdb_data_cache and tempdb_log_cache.
20
Create a sub-directory under this partition with server name and put the tempdb data and log files there
tempdb_devices/SYB_UDEQA2% ls SYB_UDEQA2_tempdb_data1 SYB_UDEQA2_tempdb_log1
25
26
tempdb Configuration
Remove tempdb from the master Device
It is a good idea to remove the first segment of tempdb from the master device. The size of this segment is 2MB. The system tables for tempdb are created there and this can create performance bottlenecks. Once you allocate a second device to tempdb, you can drop the master device from the default and log segments.
27
Devices
Naming conventions for sybase data devices
master : <server-name>_master.dev sybsystemprocs : <server-name>_sysprocsdev.dev data devices : <server-name>_ data<nn>.dev log devices : <server-name>_ log<nn>.dev
Permissions
All devices permissioned for sybase:dba
28
29
<Product> should reflect the Sybase product for which one of the following standard abbreviations should be used:
XP server is a special case. The XP server will be called <SERVER_NAME>_XP with SERVER_NAME in uppercase.
30
Meaning
UDE Hospitality Reconciliation Global Equities
32
35
Memory Configuration
Case study:
one host and one ASE, plus the backup server and replication server. If I am running a 32-bit Sybase then leaving 600-800MB to the operating system plus the replication server and the backup server should be sufficient. The max memory that the backup server will take is 144MB. You will be pretty safe with giving the replication server around 200MB. That leaves the rest to OS.
39
Memory Configuration
After taking the consideration for tempdb on tmpfs (assuming that you will be creating tempdb on tmpfs) and if you have enough left over memory, you can give a max memory of 4000MB to ASE itself.
40
Memory Configuration
When you start up ASE, it will go and read the configuration file <SERVER_NAME>.cfg. The total memory allocated during start up is the sum of memory required for all the configuration needs of ASE as specified in the configuration file. This value can be obtained from the read-only configuration parameter total logical memory. The configuration parameter max memory must be greater than or equal to total logical memory, otherwise ASE will fail to start.
41
Memory Configuration
Additionally, when you start up ASE, it will go and check whether there is enough shared memory available as specified by max memory parameter. If the memory is not there or the equivalent swap space is not there, ASE will fail to start as well. The important point to remember here is that checking for the availability of memory does not mean that ASE will go and grab it! ASE will use as much memory as required.
42
Memory Configuration
1> sp_configure memory 2> go Msg 17411, Level 16, State 1: Server 'SYB_UDEQA2', Procedure 'sp_configure', Line 214: Configuration option is not unique. Parameter Name Default Memory Used Config Value Run Value Unit Type ------------------------------ ----------- ----------- ------------ ----------- ----------------------------additional network memory 0 740 757760 757760 bytes dynamic allocate max shared memory 0 0 0 0 switch dynamic compression memory size 0 76 0 0 memory pages(2k) dynamic engine memory log size 0 2 0 0 memory pages(2k) dynamic heap memory per user 4096 0 4096 4096 bytes dynamic lock shared memory 0 0 0 0 switch static max memory 33792 4096000 2048000 2048000 memory pages(2k) dynamic memory alignment boundary 2048 0 2048 2048 bytes static memory per worker process 1024 48 1024 1024 bytes dynamic messaging memory 400 0 400 400 memory pages(2k) dynamic shared memory starting address 0 0 0 0 not applicable 43 static total logical memory 33792 3914828 1957414 1957411 memory pages(2k) read-only total physical memory 0 3914832 0 1957416 memory pages(2k)
Memory Configuration
Note that I have highlighted both the max memory and total physical memory. Total physical memory run value is the one telling you how much memory ASE is currently using. For example in this case ASE has 4GB of max memory but only using 1957416/512 = 3823MB in practice. Let us go through the above and make sense out of some of the parameters of interest.
44
Memory Configuration
additional network memory
This is the memory required for networks. I will cover it later
45
Memory Configuration
lock shared memory
Lock shared memory disallows swapping of Adaptive Server pages to disk and allows the operating system kernel to avoid the server's internal page locking code. This can reduce disk reads, which are expensive. It is not a sort of parameter that you want to play around with. Always ensure (through liaison with UNIX SA) that there is enough RAM to cover for your max memory specification at all times.
Cache Configuration
After taking any memory needed by the Sybase kernel the rest is allocated to the default data cache and the procedure cache. Default data cache
When ASE is created, it only has one cache, the default data cache. The raw default data cache only has default buffer pools. The default buffer pool is the ASEs page size. So if you created ASE with 2K page size, then the default data cache will be made of 2K buffer pools. However, you can add additional buffer pools as we will consider shortly. In ASE, any table or index, which does not have a binding or is not within a database bound to a named cache, will use the default data cache. You cannot rename or delete the default data cache.
47
Cache Configuration
However, you can add additional buffer pools as we will consider shortly. In ASE, any table or index, which does not have a binding or is not within a database bound to a named cache, will use the default data cache. You cannot rename or delete the default data cache.
48
Cache Configuration
You can adjust the size of default data cache dynamically. For example to allocate 900MB to default data cache you can use the following command:
sp_cacheconfig 'default data cache' , '900M go (return status = 0)
49
Cache Configuration
Named Cache
ASEs logical memory manager is capable of maintaining multiple caches. These user-defined caches are referred to as named cache. When you create named caches, you are effectively slicing up the shared memory allocated to ASE into a number of separate data caches. Each named cache can be reserved for specific databases or database objects such as tables and indexes. In ASE, this process is called binding databases or objects to cache.
50
Cache Configuration
ASE binding enables the following:
Allows frequently accessed objects to be kept in memory by preventing other objects data pages to use the reserved pages Minimizes the effect of one application from another Stops the memory hungry applications from flushing out the useful data from the cache Can be configured with different cache pools Gives DBA a degree of control on using the available memory efficiently
51
Cache Configuration
ASE binding enables the following:
Both the default data cache and named caches can be configured dynamically. This reduces or minimizes the downtime of the server. Additionally the default data cache and named cache can also be split into multiple cachlets to reduce the spinlock contention.
52
Cache Configuration
An example of a named cache would be a private cache for dbccdb (database consistency check) database. You are advised to create a private cache for dbcc operations and bind dbccdb database to this cache. This is because typically a dbcc operation has to read data for all tables sequentially. This means caching as much data in a single IO as possible and obviously all the data pages.
53
Cache Configuration
Thus, the larger block size of 16K or more is ideal for dbcc operations and hence you should create good size large buffer pools in dbccdb cache. You also do not want dbcc operation to flush out your valuable data out of memory. Having a properly configured named cache for this purpose makes dbcc operation more efficient, and stops large table scans potentially flushing out useful data from the default data cache.
54
Cache Configuration
Each named cache can be further tuned including:
Size of the cache Multiple buffer pools. Location of the wash marker in the MRU/LRU chain The type of cache, log or mixed The cache replacement policy, strict or relaxed The number of partitions (cachlets) in the cache
55
Cache Configuration
Large IO and Multiple Buffer Pools
When more than one buffer pool is available in a cache, the ASE optimizer determines the optimal page size for each query and uses the appropriate buffer pool. ASE allows you to configure up to four larger page sizes. With 8K page size, buffer pools of 8K, 16K, 32K and 64K can be configured. Example below shows this:
56
Cache Configuration
Type Config Value Run Value ------- ------------ -----------Default 1625.00 Mb 1625.00 Mb ------------ -----------Total 1625.00 Mb 1625.00 Mb ====================================================================== ==== Cache: default data cache, Status: Active, Type: Default Config Size: 1625.00 Mb, Run Size: 1625.00 Mb Config Replacement: strict LRU, Run Replacement: strict LRU Config Partition: 4, Run Partition: 4 IO Size Wash Size Config Size Run Size APF Percent -------- --------- ------------ ------------ ----------16 Kb 5120 Kb 25.00 Mb 25.00 Mb 10 32 Kb 20480 Kb 100.00 Mb 100.00 Mb 10 64 Kb 61440 Kb 300.00 Mb 300.00 Mb 10 8 Kb 61440 Kb 0.00 Mb 1200.00 Mb 10 (return status = 0) 57 1> sp_cacheconfig 'default 2> go Cache Name Status ------------------ -----default data cache Active data cache'
Cache Configuration
Table below summarizes the logical page size and the corresponding Buffer pool sizes.
Logical page size/KB 2 4 8 16 Buffer pool sizes/KB 2, 4, 8, 16
Cache Configuration
1. Example of creating a user defined cache and the associated pools 1> sp_cacheconfig tempdb_log_cache, '500M','logonly','relaxed', 'cache_partition=1' 2> go Since this is a log cache, it should be mainly made up of 4K buffer pools and some 16K buffer pools as well: 1> sp_poolconfig "tempdb_log_cache", "370M", "4K", "2K" 2> go 1> sp_poolconfig "tempdb_log_cache", "125M", "16K", "2K" 2> go
59
Cache Configuration
1. Display information about this cache
1> sp_cacheconfig tempdb_log_cache 2> go Cache Name Status Type Config Value Run Value ------------------------------ --------- -------- ------------ -----------tempdb_log_cache Active Log Only 500.00 Mb 500.00 Mb ------------ -----------Total 500.00 Mb 500.00 Mb ========================================================================== Cache: tempdb_log_cache, Status: Active, Type: Log Only Config Size: 500.00 Mb, Run Size: 500.00 Mb Config Replacement: relaxed LRU, Run Replacement: relaxed LRU Config Partition: 1, Run Partition: 1 IO Size Wash Size Config Size Run Size APF Percent -------- --------- ------------ ------------ ----------2 Kb 1024 Kb 0.00 Mb 5.00 Mb 10 4 Kb 61440 Kb 370.00 Mb 370.00 Mb 10 16 Kb 25600 Kb 125.00 Mb 125.00 Mb 10
60
Procedure Cache
ASE uses procedure cache to hold the following in the memory:
Cached stored procedure plans, triggers and cursors Object permissions and column statistics Statement Cache (ad hoc SQL) Short term memory needs Others
61
Procedure Cache
This makes the size of procedure cache important. Also you may choose to size procedure cache larger in DEV compared to production. You specify the size of procedure cache in 2K pages. If ASE finds a copy of a procedure already in the cache, it does not need to read it from the disk. If you create a procedure WITH RECOMPILE option, it will add another plan anytime it is executed that could be far from ideal.
62
Procedure Cache
Since the optimum value for procedure cache size differs from application to application, resetting it may improve Adaptive Server's performance. For example, if you run many different procedures or ad hoc queries, your application uses the procedure cache more heavily, so you may want to increase this value. As a rule of sum a procedure cache size between 150-300MB should be sufficient for most of your applications.
63
Procedure Cache
ASE uses Statement Cache to store the text of ad hoc SQL statements. ASE compares a newly received ad hoc SQL statement to cached SQL statements and, if a match is found, uses the plan cached from the initial execution. The statement cache is a server-wide resource, which allocates and consumes memory from the procedure cache. However, the ad hoc SQL is used in ASE is far from perfect.
64
Procedure Cache
Both Oracle and ASE use a hashing mechanism to identify the ad-hoc SQL. In ASE the hash is a combination of literal SQL text, login ID and session settings (results of "set" commands, generally). Unfortunately this means the hash is not so useful for determining highly repeated SQL.
65
66
Number of devices
As a rule of thumb you can set this one to 30
1> sp_configure devices 2> go Parameter Name Default Memory Used Config Value Run Value ------------------------------ ----------- ----------- ---------------------number of devices 10 #17 30 30
68
User Connections
A value of 100 should be sufficient for most non production servers 1> sp_configure 'user connections' 2> go Parameter Name Default Memory Used Config Value Run Value ------------------------------ ---------- ----------- ------------ ---------- number of user connections 25 17261 100 100
69
70
71
interfaces file
On hosts with multiple Sybase servers and versions it is important to maintain one interface file for all! This file should reside in ~sybase directory (as opposed to $SYBASE). Be aware that the default interfaces file presented by dsedit will need to be changed when adding/updating the interfaces file
72
73
Time Zones
It is becoming increasingly necessary to have multiple Sybase servers running on the same host with different time zones. Thus, it will be necessary to have an environment file for each server to ensure the correct settings (see below). A list of available timezones is provided in the directory /usr/share/lib/zoneinfo as follows:
74
Time Zones
ls /usr/share/lib/zoneinfo America Hongkong Asia Iceland Australia Iran Brazil Israel CET Jamaica CST6CDT Japan Canada Greenwich Chile Libya Cuba MET EET MST EST MST7MDT EST5EDT Mexico Egypt Mideast Eire NZ Etc Kwajalein Factory Navajo GB PRC GB-Eire PST8PDT GMT Pacific GMT+0 Poland GMT+1 Portugal GMT+10 ROC GMT+11 NZ-CHAT GMT+12 Singapore GMT+13 Turkey GMT+2 UCT GMT+3 US GMT+4 UTC GMT+5 Universal GMT+6 W-SU GMT+7 ROK GMT+8 Zulu GMT+9 posixrules GMT-0 src GMT-1 GMT-10 GMT-11 GMT-12 GMT-2 WET GMT-3 GMT-4 GMT-5 GMT-6 GMT-7 GMT-8 GMT-9
HST
75
Environment Files
ASE by default provides two environment files in $SYBASE. Depending on the shell that you are using you can source either SYBASE.sh or SYBASE.csh.
76
Environment Files
.profile
The .profile script will be executed first. As an example, it will have the following entries (lon_epg_sql_dev1)$ more .profile export ENV=$HOME/.kshrc # export PATH=$PATH:/usr/local/bin:$HOME/dba/bin:$HOME # echo "" echo "+============================================================+" echo "| |" echo "| Enter the following commands: |" echo "| |" echo "| SYB_LDN_EPG_DEV01 - 12.5.4 (default) |" echo "| SYB_LDN_EPG_UAT01 - 12.5.4 |" echo "| SYB_LDN_EPG_DEV02 - 12.5.4 64 bit version |" echo "| |" echo "+============================================================+" echo "" stty erase set -o vi HOSTNAME=`hostname` ulimit -Sn 1024 export EDITOR=vi . ~sybase/SYB_LDN_EPG_DEV01/dba/bin/environment.ksh
77
Environment Files
It will in turn allow you to invoke any of the above server settings by having the correct entries in the .kshrc file (SYB_LDN_EPG_DEV01)$ more .kshrc
export TERM=vt100 alias isql='isql -w132' alias sa='isql w000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000 000000000000000000000001000 -Usa P$(~/dba/bin/get_password.ksh $DSQUERY sa) ' alias SYB_LDN_EPG_UAT01='. ~sybase/ SYB_LDN_EPG_UAT01/dba/bin/environment.ksh' alias SYB_LDN_EPG_DEV01='. ~sybase/SYB_LDN_EPG_DEV01/dba/bin/environment.ksh' alias SYB_LDN_EPG_DEV02='. ~sybase/ SYB_LDN_EPG_DEV02/dba/bin/environment.ksh'
78
Environment Files
environment.ksh A typical environment file will have the following entries
#!/bin/ksh # # Program: # Type: # Description: correct # # # # Author: # Version: # # Modified: #
environment.ksh Server specific This script will be modified on each site to contain the values to be held in environment variables. This script is called from every other script to ensure that the correct environment has been defined for their execution. Mich Talebzadeh 3.0
79
Environment Files
environment.ksh
################################### # Modify the following lines only export TZ=GB export SYBASE=~sybase/SYB_UTS1 export SYSTEM=UDE export DSQUERY=SYB_UTS1 export REFERENCE_SERVER=SYB_UTS1 export BSQUERY=${DSQUERY}_BACKUP export DUMPDIR=/localdisk/refresh_db_temp_dumps export AUDITDIR=${DUMPDIR}/audit ##ulimit -Sn 2048 ###################################
80
Environment Files
environment.ksh ################################### # 12.5 Stuff export SYBASE_ASE=ASE-12_5 export SYBASE_OCS=OCS-12_5 export SYBASE_FTS=FTS-12_5 export SYBASE_SYSAM=SYSAM-1_0 export LD_LIBRARY_PATH=$SYBASE/$SYBASE_ASE/lib:$SYBASE/$SYBAS E_OCS/lib:$SYBASE/$SYBASE_OCS/lib3p export LM_LICENSE_FILE=$SYBASE/$SYBASE_SYSAM/licenses/license.dat ###################################
81
Environment Files
################################### GENERIC_ROOT=~/dba SPECIFIC_ROOT=~/$DSQUERY/dba export GEN_APPSDIR=$GENERIC_ROOT/bin export GEN_LOGDIR=$GENERIC_ROOT/log export GEN_ETCDIR=$GENERIC_ROOT/etc export GEN_ENVDIR=$GENERIC_ROOT/env export GEN_ADMINDIR=$GENERIC_ROOT/admin export PASSFILE=$GENERIC_ROOT/env/.syb_accounts export ADMINDIR=$SPECIFIC_ROOT/admin export TMPDIR=$SPECIFIC_ROOT/tmp ##export LOGDIR=$SPECIFIC_ROOT/log export LOGDIR=/var/tmp export ETCDIR=$SPECIFIC_ROOT/etc export HTMLDIR=$SPECIFIC_ROOT/html export APPSDIR=$SPECIFIC_ROOT/bin
82
Environment Files
for ELOG in $SYBASE/$SYBASE_ASE/install/$DSQUERY.log $SYBASE/$SYBASE_REP/install/$DSQUERY.log $SYBASE/install/$DSQUERY.log do if [ -f ${ELOG} ] then export ERRORLOG=${ELOG} fi done for BLOG in $SYBASE/$SYBASE_ASE/install/$BSQUERY.log $SYBASE/install/$BSQUERY.log do if [ -f ${BLOG} ] then export BACKUPLOG=${BLOG} fi done PATH=.:$PATH:/usr/bin:/usr/sbin:$APPSDIR:$GEN_APPSDIR:/opt/misc/bin for DIR_CHECK in ${SYBASE}/${SYBASE_REP}/bin ${SYBASE}/${SYBASE_REP}/install ${SYBASE}/${SYBASE_ASE}/bin ${SYBASE}/${SYBASE_ASE}/install ${SYBASE}/${SYBASE_OCS}/bin ${SYBASE}/bin ${SYBASE}/install do if [ -d ${DIR_CHECK} ] then PATH=$PATH:${DIR_CHECK} fi done
83
Environment Files
export TRANDUMPDIR=$DUMPDIR/tran PATH=/usr/kerberos/bin:/bin:/usr/bin:/usr/local/bin:/u sr/bin/X11:/usr/X11R6/bin:/usr/sbin:$SYBASE/$SYBA SE_ASE/bin:$SYBASE/$SYBASE_OCS/bin:$SYBAS E/$SYBASE_ASE/install:$SYBASE/ASEP/bin/:$APPS DIR:$GEN_APPSDIR ##export SUPPORT=sybase@`hostname` export SUPPORT=mich.talebzadeh@uk.fid-intl.com export PS1=`hostname`:'($DSQUERY)$ '
84
RUN_${DSQUERY} file
To ensure that the Sybase Server starts in the correct timezone etc, make sure that you modify the RUN_server file to execute the relevant environment.ksh file as shown in the following example: #!/bin/ksh # # Define Sybase environment variables # . /export/home/sybase/SYB_UDEQA2/dba/bin/environment.ksh # # Adaptive Server name: SYB_UDEQA2 # ASE page size (KB): 2k # Master device path: /export/home/sybase/SYB_UDEQA2/devices/SYB_UDEQA2_master.dev # Error log path: /export/home/sybase/ASE/1254/ASE-12_5/install/SYB_UDEQA2.log # Configuration file path: /export/home/sybase/ASE/1254/ASE-12_5/SYB_UDEQA2.cfg # Directory for shared memory files: /export/home/sybase/ASE/1254/ASE-12_5 # $SYBASE/$SYBASE_ASE/bin/dataserver \ -sSYB_UDEQA2 \ -d/export/home/sybase/SYB_UDEQA2/devices/SYB_UDEQA2_master.dev \ -e$SYBASE/$SYBASE_ASE/install/SYB_UDEQA2.log \ -c$SYBASE/$SYBASE_ASE/SYB_UDEQA2.cfg \ -M$SYBASE/$SYBASE_ASE \
85
References
1. Sybooks. Online ASE manuals from:
http://infocenter.sybase.com/help/index.jsp
86