
    Wim ten Have, <wtenhave@sybase.com>
    Sat Jan 22 13:00:14 CET 2000

    Linux/ASE 11.0.3.3 ESD#6 FREE last minute notes.



    === PACKAGES ===

    o Sybase ASE 11.0.3.3 ESD#6 	sybase-ase-11.0.3.3-6.i386.rpm
					sybase-ase-11.0.3.3-FreeBSD-i386.tgz

      Sybase Adaptive Server Enterprise 11.0.3.3 run-time environment
      providing - SQL Server, Backup Server, Monitor Server, Probe,
      Buildmaster Langinstall, Charsets, Sybinit, Sybmon, Isql, Bcp,
      Defncopy, ESQL/C, Localization and International Charactersets.


    o Sybase OCSD 10.0.4		sybase-ocsd-10.0.4-6.i386.rpm
					sybase-ocsd-10.0.4-6.alpha.rpm
					sybase-ocsd-10.0.4-FreeBSD-i386.tgz

      Platform native Sybase Open CLient and Open Server Development Kits.


    o sybase DOC 11.0.3.3		sybase-doc-11.0.3.3-6.noarch.rpm
					sybase-doc-11.0.3.3-FreeBSD-i386.tgz

      Standard Sybase documentation for UNIX systems in PostScript.


    o sybase CONTRIB 1.0		sybase-contrib-1.0-1.i386.rpm

      Pointers to Sybase contributed software for ASE and OCSD related
      components providing - Sybperl, Sybtcl, Sqsh, Php3.  Idea behind
      the contrib package is to smoothen installation and distribution
      for GPL software products.  The package distribution header does
      contain URL's to the software home pages where the source packages
      can be collected.



    === CONFIGURATION ===

    Before configuring Sybase Adaptive Server Enterprise it is strongly
    advised to install correct accounts and permissions.  A special
    helper script is available within the $SYBASE/install directory.
    You need to run this script with Super User (root, uid=0) permissions.

	[example]

	# export SYBASE=`rpm -q --queryformat \
		'%{installprefix}\n' sybase-ase-11.0.3.3`

	# ${SYBASE}/install/sybinstall.sh

    Wait with further installing if you like to setup the database devices
    for Raw disk I/O.  The process to administrate and configuring them
    is explained below under FEATURES.




    === FEATURES ===

    New to the Linux platform is support added towards Raw and
    Asynchronous disk I/O, and automatic supported use for large memory
    models under Linux.  To take advantage on the Asynchronous and Raw
    disk I/O kernel support needs to be present on the target platform.
    As the features are limited available within the standard distribution
    you may need to obtain kernel patches from:

    o Raw disk I/O - Stephen Tweedy
	<ftp://ftp.uk.linux.org/pub/linux/sct/fs/raw-io/>

      Take NOTE that this patch is by default available and pre-installed
      within the Red Hat RH6.1 with kernel 2.2.12-20 for Intel and Alpha.


    o Async storage I/O (KAIO) - SGI Open Source
	<ftp://oss.sgi.com/www/projects/kaio/download/>


    Sybase Adaptive Server Enterprise and Sybinit are internally enhanced
    to recognize and take advantage when requested to build and mount
    database devices for the above features.  As configurations can
    vary Database Administrators and System Administrators may like to
    explore the below configurable setups - Linux only:

    o Raw disk I/O - Testing and performance optimization was performed
      towards EIDE, UDMA/66 and SCSI disk setups.  SQL Server, Buildmaster
      and Sybinit are enabled to understand the 'raw' device bindings.

      Before installation and configuration it is advised to setup for
      correct device name, permissions and group access.  The packages
      are equipped with a script to help during the configuration.

	${SYBASE}/install/sybdevices.sh

      Partition your spindle with fdisk(8).  Use partition Id '60'
      to indicate a Sybase Raw device.  (See the below scripted example)

      [create a sybase dedicated partition]

	# fdisk /dev/hda
		..
	Command (m for help): n
	First cylinder (2112-2116, default 2112): 
	Last cylinder or +size or +sizeM or +sizeK (2112-2116, default 2116): 
	Using default value 2116

	Command (m for help): t
	Partition number (1-11): 11
	Hex code (type L to list codes): 60
	Changed system type of partition 11 to 60 (Unknown)

	Command (m for help): w


      [list per disk sybase dedicated partitions - principle]

	# fdisk -l /dev/hda | tr -d '\*' | \
			awk '{ if ($5 == 60) print $1"\t"$4"\t"$5 }'


      [show - all sybase dedicated partitions]

	# ${SYBASE}/install/sybdevices.sh show
	/dev/hda8       88326 blocks
	/dev/hda9       88326 blocks
	/dev/hda10      48163 blocks
	/dev/hda11      40131 blocks


      [create - all sybase dedicated raw device entries]

	# ${SYBASE}/install/sybdevices.sh create
	/dev/raw1 c 162 1
	/dev/raw2 c 162 2
	/dev/raw3 c 162 3
	/dev/raw4 c 162 4


      [bind - all sybase dedicated raw device entries to their partitions]

	# ${SYBASE}/install/sybdevices.sh bind
	/dev/raw1:      bound to major 3, minor 8
	/dev/raw2:      bound to major 3, minor 9
	/dev/raw3:      bound to major 3, minor 10
	/dev/raw4:      bound to major 3, minor 11

	
      [list - all sybase dedicated raw device bindings]

	# ${SYBASE}/install/sybdevices.sh list
	/dev/raw1:      bound to major 3, minor 8
	/dev/raw2:      bound to major 3, minor 9
	/dev/raw3:      bound to major 3, minor 10
	/dev/raw4:      bound to major 3, minor 11


   o Asynchronous storage I/O - When operating ASE 11.0.3.3 ESD#6 with
     database devices configured for Raw disk I/O, ASE will mount the
     configured devices with "async i/o" enabled.  The number of engine
     Async queue managers can be controlled with an environment variable
     ${AIO_NTHREADS} which may vary between 1 and 64.  The ASE internal
     setup default is 1 kaiod-thrd per engine.

     % kernel  Dynamic loadable KAIO support enabled with 1 kaiod-thrd / engine.
     % kernel  Initializing virtual device 0, '/work/sybase/master.dat'
     % kernel  Virtual device /work/sybase/master.dat allows for async i/o on regular file.
     % kernel  Virtual device 0 started using asynchronous i/o.

     Before you can enable Asynchronous I/O within ASE you need to have
     support for KAIO within the linux kernel and have the 'kaioasync.so'
     in place.  The dynamic loadable shared object 'kaioasync.so' is
     loaded by ASE under control of dlopen(2) systemcall and is a slightly
     different implementation of the SGI provided version.  This way
     ASE will allow you to further anticipate on possible KAIO changes.

     Final notes of the day are that the KAIO version used are the KAIO 
     kaio-kernel-2.2.13 changes applied on either linux kernel-2.2.13 or
     linux kernel-2.2.14.  The kaio-kernel-2.2.14 changes seem easily to
     result in semop(2) running out of resources.  This is *not* an ASE
     problem and needs further Linux kernel investigation.

     See $SYBASE/GPL/kaiodriver and $SYBASE/GPL/kernel-kaio subdirectories
     to add the Async driver and KAIO support to your platform.

     NOTE: as this feature requires a lot of platform administration you
     should be warned that it does not work out-of-the-box today ;-)  
     Final testing at our end was done under a complete KAIO SMP setup
     with 4 kaio-threads per engine configured!


     [example when booting as under uid 'sybase']

     	$ export AIO_NTHREADS=4
	$ ${SYBASE}/install/startserver -f ${SYBASE}/install/RUN_SYBASE

     If ASE 11.0.3.3 ESD#6 is configured towards file-system or block
     special based database devices it will by default use "standard i/o".
     ASE does also allow for Asynchronous storage I/O towards these
     filesystem mapped devices by mounting them with the 'sticky' bit
     set on the device i-node before mounting them.

     [example is towards a file-system located master device]

	$ chmod 1660 ${SYBASE}/master.dat
	$ ls -l ${SYBASE}/master.dat
	-rw-rw---T   1 sybase   sybase      22020096 Jan 22  2000 master.dat
		 ^
		 Indicates the S_ISVTX bit set.

     Be sure to check have your server configured correctly after the
     sticky bit is set on the filesystem mapped device(s).

	$ isql -Usa -P
	1> sp_configure "allow sql server async i/o", 1
	2> go



   === GOTCHAS AND OTHER INTERESTING THINGS TO KNOW ABOUT ===

   o Adaptive Server Enterprise 11.0.3.3 ESD#6 is internally equipped with
     routines to determine the run-time model.  During server boot you will
     notice a message giving feedback on the run-time environment found.

     [Native Linux]
     % kernel  Internal run-time model set for Linux

     [Linux ABI]
     % kernel  Internal run-time model set for FreeBSD

     Server memory allocation routines take different strategy when
     running under Linux or FreeBSD due to these internal models.
     The server is internally capable of selecting and setting for
     maximum shared memory allocation wrt the platform.  Under Linux a
     large memory model was exercised with segments covering nearly all
     virtual memory address space.

     You need to setup correctly for MAXSHM parameters however.

     [Native Linux, example is 1 GByte]
     # expr 1024 \* 1024 \* 1024 > /proc/sys/kernel/shmmax

   o FreeBSD and Asynchronous I/O.  To allow FreeBSD taking advantage of
     the Async I/O model a FreeBSD 'kaiodriver' DLL needs to be implemented
     as done for Linux.

   o Asynchronous storage I/O DLL implementation.  If you need to you can
     create further code towards KAIO or any Async I/O support via the ASE
     internal registered DLL setup:

     dlopen(2)
	dlopen (driver, RTLD_NOW|RTLD_GLOBAL)));

	char *driver;
		Provides the pathname as collected via getenv(3) over
		"SRV_KAIODRIVER" and if not set default loaded from
		"$SYBASE/lib/kaioasync.so"

     dlsym(2)
	aio_init (int);
	aio_read (aiocb_t *);
	aio_write (aiocb_t *);
	aio_return (aiocb_t *);


     aio_error(aiocb_t *)	
		For performance reasons aio_error(2) was implemented as
		a macro and will directly collect the struct aiocb {};
		passed errno information from the KAIO subsystem.


     Take note that Adaptive Server Enterprise is a highly optimized
     and complex threading package.  Your Async I/O driver subsystem
     should be MT-safe and *not* duplicate any address space other then
     using clone(2) with CLONE_VM defined. (share virtual address space).

     Experiments using the Linux native librt.so (aio_ functions)
     resulted in many shortcomings and erroneous events.

   o Raw disk I/O.  Adaptive Server Enterprise and other supporting
     servers as Sybinit and Backupserver internally provide support for
     character device support with their alignment set towards 512 Byte
     user buffer operations.  Under conventional UNIX operating systems
     the alignment is usually set to the platform WORD format.  Backup
     server internally allows for blocksizes for a multiple of 512 Bytes
     from 512 Bytes to 4096 Bytes for a maximum tape blocksize.  If you
     have need to go beyond or use different settings then 'sybmultbuf'
     allows for conversion.

   o SMP setups.  Under Native Linux Adaptive Server Enterprise does
     collect the number and performance it tunes for on physical CPU's
     installed from the /proc/cpuinfo file system.  If your detection
     failes under Linux ABI or Linux Emulation setups you can overrule
     this detection by setting an environment variable 'SRV_CPUCOUNT'
     to the number of engines ASE may spawn for.

	$ export SRV_CPUCOUNT=8
	$ isql -Usa -P
	1> sp_configure "max online engines", 8
	2> go
	1> sp_configure "min online engines", 8
	2> go
	1> shutdown
	2> go
	$ cd $SYBASE/install
	$ ./startserver -f ./RUN_YOUSERVER

     Make sure to have enough process slots available as under a
     kaiod-thrd environment any engine will spawn up to "AIO_NTHREADS"
     additional threads.  Your system resources may easily exhaust when
     not correctly tuned!



   === REGISTER ===

   We would like you to register your installation and find more
   information about Sybase Software available for Linux from:

	<http://linux.sybase.com>

   Enjoy this Sybase Adaptive Enterprise Server installation !


