Home » RDBMS Server » Performance Tuning » Call from specified Machine not assigned to Database resource consumer. (Release 11.2.0.3.0 - 64bit)
Call from specified Machine not assigned to Database resource consumer. [message #595093] |
Fri, 06 September 2013 10:15 |
|
VIP2013
Messages: 91 Registered: June 2013
|
Member |
|
|
I am using Release 11.2.0.3.0 - 64bit Production version of oracle. Now we are having 3-tier architecture, (firewal/web/app/DB).
Now i saw , some of the 'sql' queries, running till ~10hrs in my database and those are part of application(module JDBC THIN CLIENT). After had a talk java guys, they ask to kill the sessions specific to those queries. They are part of search TO, in which user put some large values for the date range and went to other TAB, but these queries gets running infinitely in the database, and user is not interested in the result set.
So how to avoid these things, as because in past, our database has suffered resource contention leading to application slowness. So i was planing to set different timeouts using 'database resource consumer group' for online user request and batch request depending on the app server(that is by machine names) request.
So i have done below set up in my local to test one scenario, in which i will try give a database call from difference machine, and it should get timeout after the specified duration. But its not working , as expected. The calls from the specified machine are not getting assigned to the created 'Consumer group'.
Let me know, if i am missing anything.
Begin
-- create the pending area
dbms_resource_manager.create_pending_area();
END;
/
BEGIN
-- Create the consumer group
dbms_resource_manager.create_consumer_group(
CONSUMER_GROUP=>'ONLINE_USERS_LIMITED_EXEC_TIME',
COMMENT=>'This is the consumer group that has limited execution time per statement'
);
END;
/
BEGIN
-- We need a consumer group that maps to the desired machine:
dbms_resource_manager.set_consumer_group_mapping(
attribute => dbms_resource_manager.client_machine,
value => 'PAC\LR9XY7T8',
consumer_group =>'ONLINE_USERS_LIMITED_EXEC_TIME'
);
END;
/
BEGIN
dbms_resource_manager.set_consumer_group_mapping(
attribute => dbms_resource_manager.client_machine,
value => 'LR9XY7T8',
consumer_group =>'ONLINE_USERS_LIMITED_EXEC_TIME'
);
END;
/
BEGIN
-- Now create a resource plan:
dbms_resource_manager.create_plan(
PLAN=> 'LIMITED_EXEC_TIME',
COMMENT=>'Kill statement after exceeding total execution time'
);
END;
/
-- Now let's create a plan directive for that special user group , the plan will cancel the current SQL if it runs for more than 120 sec
-- You can define multiple directives depending on requirement
BEGIN
dbms_resource_manager.create_plan_directive(
PLAN=> 'LIMITED_EXEC_TIME',
GROUP_OR_SUBPLAN=>'ONLINE_USERS_LIMITED_EXEC_TIME',
COMMENT=>'Kill statement after exceeding total execution time',
SWITCH_GROUP=>'CANCEL_SQL',
SWITCH_TIME=>60,
SWITCH_ESTIMATE=>false
);
--Basically for each plan we need to define the plan directives for the OTHER_GROUPS also, what that means is determine limits for all other sessions other than those bound by the consumer group ONLINE_USERS_LIMITED_EXEC_TIME.
dbms_resource_manager.create_plan_directive(
PLAN=> 'LIMITED_EXEC_TIME',
GROUP_OR_SUBPLAN=>'OTHER_GROUPS',
COMMENT=>'leave others alone',
CPU_P1=>100
);
END;
/
exec dbms_resource_manager.validate_pending_area();
exec dbms_resource_manager.submit_pending_area();
exec dbms_resource_manager.create_pending_area();
alter system set RESOURCE_MANAGER_PLAN='LIMITED_EXEC_TIME';
After this when i am verifying calls from machine, 'LR9XY7T8' they are belongs to the consumer group 'OTHER_GROUPS' and sql query not getting timed out within 60 seconds as mentioned.
[Updated on: Fri, 06 September 2013 10:16] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Call from specified Machine not assigned to Database resource consumer. [message #595099 is a reply to message #595093] |
Fri, 06 September 2013 12:07 |
John Watson
Messages: 8963 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
I can see possible issues with your code:
First, as this is a three tier application you should use SWITCH_FOR_CALL, not just SWITCH_TIME. You don't want to downgrade the session permanently, just for the one call.
Second, you need to look at your session mapping priority. By default, client_machine is almost bottom (see dba_rsrc_mapping_priority). Perhaps you need to raise the priority of client_machine as a session mapping attribute..
|
|
|
|
|
Re: Call from specified Machine not assigned to Database resource consumer. [message #595155 is a reply to message #595152] |
Sun, 08 September 2013 00:45 |
|
VIP2013
Messages: 91 Registered: June 2013
|
Member |
|
|
Yes, Gone through the thread. But below is my requirement at this point of time.
--We are having three tier architecture, 2 web server + 10 app server + 1 DB. and we do have some online request + batch request coming to the database from the app servers. And for all of tha application request(online+batch), oracle user is same that is 'app_user'. So i cant restrict the timout for them by deviding them using oracle user, because timeout should be fifferent for online and batch. So one thing comes into my mind, during the database call, i am getting different client_machine name i.e. app server names from which request are coming. So if i can group the app server machines into two bunch, one for online and other for batch request and put them into two different database consumer group, then i can restrict different time out for each of them.
Issue:
------
Current issue i am facing, issue with assigning machines into different consumer group. Even if i am giving particular machine name in the procedure 'dbms_resource_manager.set_consumer_group_mapping' and expecting the consumer group will be mapped to that particular machine during run time, if any request comes from that machine. but its not working that way . The consumer group gets assigned to the oracle user, which is mentioned in 'dbms_resource_manager_privs.grant_switch_consumer_group' procedure, even if machine name is different.
So just want to know, if my understanding of deviding machines based on database consumer groups is implementable as per the current oracle version 11.2.0.3.0. Or issue with my script somewhere?
[Updated on: Sun, 08 September 2013 00:54] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu Jan 23 15:03:00 CST 2025
|