Sunday, April 15, 2012

Connecting to Oracle

A user makes a request using a Oracle client software to connect to the database.  For example, the client software can be SQLPlus. 

sqlplus user/password@oracle10g.localdomain

The user supplies the username and password.  The target database is represented by a TNS (Transport Network Substrate, a piece of software that make remote connection) service name.  The TNS name is translated to a hostname and port number using mapping file like tnsname.ora file, or Oracle Internet Directory (OID, a LDAP).

A TNS listener on the database server will listen on the port for incoming connection request.  For a dedicated server connection, the listener will fork() and exec() to create a new UNIX process to communicate with the user.  The dedicated server process will execute SQL request, read data from files or find data in the SGA cache.

For shared server (previously called MTS, Multi-threaded Server) connection, Oracle uses a pool of shared processes to handle user requests.  However, user does not talk directly to the shared process like a dedicated server connection.  User talks to a process called dispatcher.  The  dispatcher put user request into a request queue in SGA.  The first shared process that is not busy will pick up the request from the queue, execute the request and put the result into a respond queue in SGA.  The dispatcher picks up the result and sends back to the user over network.  When user connect to the database, the listener will choose a dispatcher from the dispatcher pools and redirect the client to the dispatcher by sending the port the dispatcher listens to.  The client software then talks to the dispatcher directly.

Oracle Instance

When Oracle starts up in UNIX, the processes are of many names and they are referred as Oracle background processes.  They are persistent and exist from the time when Oracle is started until it is shut down.  They are started from a single Oracle executable but they picked up different personalities depending on the functions they perform. In Windows, these processes becomes individual thread in a single process.

Oracle SGA is a shared memory segment that are attached to by the background processes.  In UNIX, the processes uses shmget() and shmat() calls. Under Windows, the threads use C call malloc() to allocate the memory and share it within one address space.

Sunday, April 1, 2012

ACL

User's SID is the account number that Windowss assigns to the user during login.  The access token that holds the SID also contrains structures that identify the groups the user belongs to and what privileges that the user has.  Each group entry also as a SID.  This SID points to structures that describe the group's right.

The privileges section of the access token begins with a count of the number of privileges that the user has.  This section contains an array of privilege entries.  Each privilege entry contains a Locally Unique ID (LUID), essentially a pointer to the entry object, and an attribute mask.  The mask tells what rights the user has to the object.  Group SID entries are essentially the same - a privilige count and an array of privilege entries.

Object rights flow down to the lowest possible node unless overridden by another SID.  For example, if a user has read and write privileges to \temp, those rights is applicable to all sub-folders.  This applies to container such as a word document which may contains other files.

NT Security

The protection mechanism has been around since Windows NT and thus it is called NT security.  It uses a lock and key concept.  The lock is a kind of access control and the keys are rights.  There are mulitple level of permission associated with most resources to provide fine grain control.

A user has personal rights that are assigned by administrator.  A user can belong to group which all share the same rights.  The user's access is limited to the combination of group and individual rights that the administrator assigned.

Rights can be assigned by administrator.  Likewise, developer can write code that sets Windows securotu for particular objects, calls and portions of an application.  Changes by the administraor or developer affect the rights required to perform sepecific tasks using resources such as a file.  the right to write to a file is separate from the right to read from the file.

User level access depends on Security Identifier (SID).  When a user logs in, Windows assigns an access token and place the user's SID (stored in DC) in it.  The access token contains DACL (Discretionary Access Control List) and SACL (System Access Control List).  The combination of SID and ACL in the access token allows the user access to certain resources.  As the access token is session based, user need to logoff and re-login to gain addition rights assigned by administrator during the session.

The lock is called securty descriptor on resources.  The security descriptor tells what rights the user needs to access the resource.  If the ACL meets or exceeds the rights in the security decsriptor, the lock opens.

Saturday, March 10, 2012

RAID

0 = Disk striping for performance
1 = Disk mirroring with slight performance improvement
2 = Hamming encoding.  Encode data on disk with error correcting code.  Data on a single disk is correctable when error occurs
3 = Virtual disk blocks. Data is striped across multiple disks with a single disk for parity information.  Data can be reconstructed based on parity.
4 = Dedicated parity disk.  Parity of all data is stored on a separate disk.  Data can be reconstructed based on parity
5 = Striped parity disk.  Parity is striped across all disks.

Measurement of Fault Tolerance

Coverage is the conditional probability that the system will recover automatically within the required time interval given that an error has occurred.  Coverage can be computed from the probability associated with detection and recovery.

Coverage = Prob(successful error detection) x Prob(successful error recovery)

Obtaining the probabilities used to compute coverage is difficult and requires extensive stability testing and fault insertion testings.

MTTF (Mean Time to Fail) is the average time from the start of operation until the time when the first failure happens.

MTTR (Mean Time to Repair) is the time required to restore a failing component to operation.  This includes travel time to the site to perform the repair, system intialization and recovery actions to be executed.

MTBF is the time from the start of operation until the component is repaired.  In other words, MTBF = MTTF + MTTR.

MTBF is used when the component is repairable and MTTF is when the component is not repairable.

Reliability is the probability that a system can perform according to specification for a specific period of time.  In other words, there is no failures within the specific time. 

Reliability = e ^ -(1/MTTF)

Failure rate = 1/MTTF

FIT (Failure in Time) = number of failures in 1x10^9 hours (1 billion hours)

Availability is the percentage of time that a system is able to perform its designed function. 

Availability = MTTF/(MTTF+MTTR) = MTTF/MTBF.

Note that availability is a percentage and reliability is a probability.

Dependability is a measure of a system's trustworthiness to be relied upon to perform the desired function.  The attribute of dependability is reliability, availability, safety and security.  Safety refers to the non-occurence of catastrophic failures, whose consequence is greater than the benefits.

The capacity of a system represents a tradeoff between the system's cost and its dependability under load.  When the load is higher than the capacity, the system can have a total or partial failure or in degraded performance. 

Saturday, March 3, 2012

Failure Perception

A fail-silent failure is one in which the failing unit either present incorrect result or no result at all.  Fail-slient failure is the easist type of failure to be tolerated because observerd failure is that the failing unit has stopped working.  The reason for failure is unknown but the failing element is identified and the failure is contained and not spread to other part of the system.

A crash-failure is one where the unit stops after the first fail-silent failure. 

A fail-stop failure is a crash-failure that is visible to the rest of the system.

Consistent failures are seen as the same kind of failure by all observers in the system.  Inconsistent failures are ones that appear different to different observers.  These are also called two-faced failures, malicious failure of Byzantine failures  These are most diffiuclt to isolate or correct.  An example of consistent failure is a system that report 1 to all questions.  An example of inconsistent failure is a system that report 1 to user 1 and 2 to the rest of the users, or route all traffic to a certain network address and none to another.

It is a common design principle for fault tolerance is to assume only one failure at any one time.  However, many failures have occured when this assumption is invalid. 

Fail-silent failures requires n+1 to tolerate.  Consistent failure requires 2n+1 to tolerate.  Malicious failure requires 3n+1 to tolerate.  The computer system in Space Shuttle is designed to tolerate 2 simultaneous failures which must be consistent but need not be fail-silent requires to have 5 computer systems.