[ruby-oci8-devel] Support FAN in Ruby-OCI8
shiwei.zhang at oracle.com
Fri Jun 27 04:40:19 EDT 2008
I've successfully tested the FAN functionality in my environment. The
steps are as below:
1. Set up a RAC environment.
2. Enable HA Event Notification service at the database tier. E.g. use
SQL Plus to issue a command like the following.
SQL> EXECUTE DBMS_SERVICE.MODIFY_SERVICE (service_name => 'sales',
aq_ha_notifications => TRUE, failover_method =>
DBMS_SERVICE.FAILOVER_METHOD_BASIC, failover_type =>
DBMS_SERVICE.FAILOVER_TYPE_SELECT, failover_retries => 180,
failover_delay => 1, clb_goal => DBMS_SERVICE.CLB_GOAL_LONG);
3. Make the Ruby-OCI8 linked with a threaded library and make it in
OCI_EVENT mode. (I worked out a patch to do this but you know for some
reason currently it's not merged into Ruby-OCI8. ;-) )
4. Enable tracing at the Oracle Client. I.e., set up the following
parameters in the file sqlnet.ora.
Note: This is an optional step that can help you to check whether your
FAN functionality works accordingly.
5. Begin a Select operation which will consume enough time so that you
can see the Failover happening.
6. During the Select process, shutdown the server which the client
program is being connected to within the RAC system. Then you should see
the current connection Failover to another surviving server and
continues the Select process.
7. The Failover with FAN should be much faster than that without FAN.
You can also check the tracing file to make sure FAN really works in
Christopher Jones wrote:
> Testing FAN will require some infrastructure set up and probably
> some manual monitoring under random load. I'd recommend we publicly
> document the steps for anyone who is able to do the set up, but we
> (Oracle) need to schedule the tests on our internal RAC systems to
> ensure the test is run regularly.
> shiwei zhang wrote:
> > Chris,
> > Regarding the pooling support, it's ok if we skip over the connection
> > pooling and only deliver the session pooling as default for ruby users.
> > Only providing session pooling as default can make the story more
> > understandable for ruby users. I will confirm this with you tomorrow or
> > in couple days. I can comment/delete the codes about the connection
> > pooling in the pooling patch.
> > Regarding the FAN support I prefer to set a global variable, thank you
> > and Kubo for the suggestion. I can test the functionality, but it's
> > to give out a snippet of test codes specific to the FAN assertion. I
> > haven't seen this kind of test codes in Php_Oci8 either. Do you think
> > it's necessary to give out the test codes for FAN assertion?
> > Thanks & Best Regards,
> > Shiwei
> > Christopher Jones wrote:
> >> Setting OCI_EVENT enables ruby-oci8 to receive FAN events. If
> >> ruby-oci8 uses the OCI session pool, these events will be
> >> automatically handled by the session pool. The DB must be configured
> >> to broadcast FAN events. The new PHP whitepaper
> >> shows the command the DBA would use. You have already seen the PHP
> >> OCI8 code that sets OCI_EVENTS at
> >> I'd recommend (i) making ruby-oci8 (i) making the OCI session pool
> >> default (and not bothering with OCI client connection pool - sorry
> >> Shiwei) (ii) making the event setting optional (as Shiwei indicates),
> >> since setting OCI_EVENT will start a monitoring thread.
> >> Chris
> >> KUBO Takehiro wrote:
> >> > Hi,
> >> >
> >> > On Fri, Apr 11, 2008 at 5:28 PM, shiwei zhang
> >> <shiwei.zhang at oracle.com> wrote:
> >> >> Hi, Kubo, ruby-oci8-devel,
> >> >>
> >> >> I want to implement FAN (Fast Application Notification)
> >> >> for Ruby-OCI8. Do you have any concerns about this?
> >> >> When we've supported FAN in Ruby-OCI8, ruby users can still use
> >> nearly
> >> >> the same APIs to talk to Oracle DB. They are able to choose FAN
> >> enabled
> >> >> or disabled when using Ruby-OCI8. For single DB instance it's not
> >> >> critical to enable FAN, but for multiple DB instances it's much
> >> >> beneficial to enable FAN. In PHP, if a user wants to enable FAN he
> >> needs
> >> >> to setup "oci8.events = On" in the file php.ini. Yet in
> Ruby-OCI8 we
> >> >> don't have the configuration file like php.ini, so how should we
> >> provide
> >> >> an interface for ruby user to feed in his choice? Add a
> parameter in
> >> >> OCI8.new()? Add a configuration method for the class OCI8? Do you
> >> have
> >> >> some suggestions?
> >> >
> >> > What API calls do we need to implement FAN? As far as I looked at
> >> PHP CVS
> >> > repository, it just need to pass OCI_EVENTS to OCIInitialize()'s
> >> > parameter.
> >> > Is it correct?
> >> >
> >> > If so, we can not use OCI8.new() to enable FAN, because OCI
> >> > is initialized before OCI8 class is defined.
> >> > Two ideas:
> >> > 1. set a global variable before requiring oci8.
> >> > $oci8_events = true
> >> > require 'oci8'
> >> > 2. initialize OCI Environment when it is needed.
> >> > require 'oci8' # don't initialize OCI Environment yet.
> >> > OCI8.events = true
> >> > conn = OCI8.new(...) # initialize OCI Environment.
> >> > _______________________________________________
> >> > ruby-oci8-devel mailing list
> >> > ruby-oci8-devel at rubyforge.org
> >> > http://rubyforge.org/mailman/listinfo/ruby-oci8-devel
> > _______________________________________________
> > ruby-oci8-devel mailing list
> > ruby-oci8-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/ruby-oci8-devel
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ruby-oci8-devel