Skip to Main Content
  • Questions
  • Prioritizing processes differently in MTS

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Mohit.

Asked: February 26, 2002 - 11:24 am UTC

Last updated: April 05, 2004 - 5:22 pm UTC

Version: 8.1.x

Viewed 1000+ times

You Asked

Hi Tom,

I would like to know if there is any way we can assign "priorities" to processes in an Oracle MTS environment so that the Dispatchers allocate more time and resources to those processes as opposed to others they may have.

I know that the MTS architecture is mainly meant to be used in an online environment with a large user base... with the underlying assumption that all processes are equal, but I was wondering if it is possible to specify some processes as being more equal than others (kind of "First among Equals"!)

Many thanks for the time you spend resolving all the queries here. I found out about your site quite by accident and have been a regular fan since!

Bext regards,

Mohit.

and Tom said...

I don't think you want to prioritize PROCESSES -- but you might want to prioritize sessions.

See
</code> http://docs.oracle.com/cd/A87860_01/doc/server.817/a76956/part6.htm#435958 <code>

prioritizing a process, especially in MTS, would be bad. From call to call you'll get different shared servers. So one time you would be "high priority", one time "low" -- for the same session.

Rating

  (8 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A followup....

Mohit Dubey, February 26, 2002 - 12:59 pm UTC

Many thanks for the prompt and lucid reply, Tom!

The reason why I asked this question was that we are hitting the wall with maximum allowable sessions on our 8.1.7 db here (the system is an online/batch mix, leaning a bit towards the batch side) and I do not want to keep on increasing the SESSIONS/PROCESSES ad infinitum. All processes log in to the same schema.

I suggested we go in for an MTS/dedicated hybrid where batch processes get in via the dedicated connect string and the online via the MTS one.

However, some bright minds want to put EVERYTHING on MTS and then assign a higher priority to the batch processes.

As I see it, the "resource" approach would mean associating all new connections to a "normal" group, then running a script to get sid/ser# of all running batch processes and switching them to a high priority group (if they are not in there).

My gut feel says to go with the hybrid approach rather tahn mess about with resource groups. Comments?

The Oracle manual (rightly, in my opinion) cautions against using MTS for batch-type processes. Based on your experience, what is the avg. performance hit if batch-processes are run in MTS mode as against dedicated?

Thanks once again.

Mohit.

Tom Kyte
February 26, 2002 - 2:23 pm UTC

batch processes are NOT suitable for MTS (shared server). They will tend to monopolized the SHARED server (they are not very good at sharing, batch processes are GREEDY).

The hybrid approach is the CORRECT answer, couple with resource mgmt if you want finer grained control.

All you need is a couple of long running statements to take over and monopolize a SHARED server and your online people are hosed.

If you have my book -- I go into this in some detail (it's one of my first examples of how to fail -- use MTS for things that take a long time to run). That should squash all discussion. It is not performance of statements in as much as starvation of end users -- they, the humans, get no resources whilst the batch processes consume them all. Humans get mad when this happens.

some more explanation please..

Yogeeraj, February 26, 2002 - 11:26 pm UTC

hello
So is it true that in general, for systems similar to what our friend, Mohit, is describing here we should implement a hybrid MTS/Dedicated configuration?

But, by going to dedicated server processes, each user will allocate their own memory on the server instead of sharing memory. This increased memory consumption can lead to paging which can be a performance killer. In general, what are the typical resource management parameters for finer grained control?

By the way, the shortcut to your "new book" does not seem to be working. (</code> http://asktom.oracle.com/pls/ask/z?p_url=http%3A%2F%2Fwww.wrox.com%2FACON11.asp%3FWROXEMPTOKEN%3D181202ZLbcpHDVSYHk38gI4FRM%26ISBN%3D186100690x&p_cat=BEG_ORACLE&p_company=10 <code>

Best Regards
Yogeeraj

Tom Kyte
February 27, 2002 - 8:07 am UTC

Yes, batch processes that connect to the database, use the connection pretty much 100% of the time and disconnect should get a dedicated server (they are in fact going to make use of that resource heavily, they won't "share" nicely).

End user processes (clients) that connect to the database, use the connection for brief periods with long periods of inactivity (as you might see in any application with end user interaction -- its called "think time") can use MTS nicely. They "share" the resource.

Now, as for the MEMORY.... Thats interesting. First -- I am saying only that BATCH PROCESSES get a dedicated server (not that EVERYONE gets one). I would envision on a system like this you have 1,000 "humans" connected and many 10 batch processes (i mean -- how many batches do you run typically -- not thousands, but rather 10's). So, we are talking about have a very few dedicated servers, some shared servers and 1,000s of users.

Also interesting is the belief that MTS will DRAMATICALLY reduce the memory consumption. It may reduce it -- but in my experience *not dramatically*. There are two pieces of memory to consider

o UGA - the user global area
o PGA - process global area

In MTS, the UGA is moved from the PGA (where it resides in a dedicated server environment) into the SGA. You configure the LARGE_POOL to be big enough to hold all of your UGA's (and this is considerable in size). The sum of the sizes of the UGA's do not GO DOWN at all in MTS and in fact, you must ensure you have sized the large pool large enough at startup time in order to support the number of concurrent sessions! The UGA is *not* shareable memory -- its your session state.

Now, that leaves the PGA. We'll have less PGA's this is true. How much memory this saves depends on many factors. For example, sort_area_size is setting that affects the size of a PGA. When we sort, we'll allocate UPTO sort_area_size bytes of memory in the PGA to sort. As soon as we are done sorting -- the data is moved into the uga (sort_area_retained_size), and we'll release that PGA memory and use it for other things. So, if you have only 10 people sort at the same time (the premise behind using MTS is you have lots of users, only a certain % of which are concurrently active at the same time so you can use a shared server) having 10 shared servers will consume just about the same amount of memory.

What MTS buys you mainly is LESS processes/threads on the system, less context switching going on, less for the os to manage. The memory savings are there, but they are not as big as people seem to make them be out to be. Its mostly in the reduced NUMBER OF PROCESSES that the OS has to manage.

So, I would stand by this answer:

o batch = dedicated server
o online = shared server, if and when the OS has run out of resources.

See
</code> http://asktom.oracle.com/pls/ask/z?p_url=http%3A%2F%2Fwww.wrox.com%2FACON11.asp%3FISBN%3D186100690x&p_cat=BEG_ORACLE&p_company=10 <code>




for a link that should work (appears wrox had some session information in the other url and that session "expired") . I updated the home page as well.



Thanks Tom!

Mohit Dubey, February 27, 2002 - 6:16 am UTC

Thanks for the reply Tom. Your comments were on the exact same lines as my thinking!

I think the people here need a little more convincing, though... so I now plan to setup a database with MTS enabled and have them run a couple of batch process and online screens simultaneously.... oh well!

Best Regards,

Mohit.

Tom Kyte
February 27, 2002 - 8:16 am UTC

or, just get them my book and have them read it. maybe, just maybe, once they understand HOW it works, they will see the light.

At least it is extremely easy to fix if they proceed. You'll only need to change a connect string for the batch processes.

a helpful discussion of MTS.

Cynthia, October 02, 2002 - 5:27 pm UTC


Maybe MTS might help against DOS attacks

A reader, April 05, 2004 - 10:08 am UTC

Tom, my situation is as follows:

I want to defend myself against "in-house" DOS attacks. Let me tell you the story...

There is one "in-house" application that for some unknown reason (we're working on fixing it) begins to open connections and reaches the maximum process number (500) presently set. And then, no one else has access to Oracle.

I have tried to set the maximum number of sessions in its profile to 30, but that wouldn't help, since they log on and out very rapidly and there aren't in fact many simultaneous oracle db sessions for that app. But the server processes "accumulate".

I have to do that at the network layer really.

When I use "netstat -a". I see all incoming "established" (near 500) connections come from the app's machine.

I would simply like some solution to limit the number of network connections this application might reach.

Presently I'm using only dedicated processes.

I thought of using MTS for that, but I still haven't figured out how, exactly. Something like setting the maximum number of connections for a dispatcher exclusively for that app, or what...

I know the best thing to do is fix the applicaton, but I want to defend myself from eventual "DOS" attacks like this.

I have asked the security guys here to set some firewall rules for that, but that seems complicated. Yet, I'd rather enforce it in the database/oracle net.

What do you recommend ?

Thank you very much !

Tom Kyte
April 05, 2004 - 11:59 am UTC

why are the server processes "accumulating"?? if they log out, it should go away, if they are not -- there is something fundementally wrong.


You can (and always do) run MTS and dedicated server at the same time (you cannot have an MTS only database).

You can setup an MTS service (this app will have its own tns connect string) and set the max servers to some reasonable number. It'll not spawn a process for each connection in this fashion.

I'd recommend however that if you are seeing orphaned processes after someone disconnects you contact support and get that fixed.


Continuning from above...

A reader, April 05, 2004 - 10:35 am UTC

Maybe setting connections in dispatchers ?

Additional dispatchers

A reader, April 05, 2004 - 1:32 pm UTC

I'm having a hard time configuring additional dispatchers.

I already have:

SQL> show parameter dispatchers

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dispatchers                          string      (PROTOCOL=TCP) (SERVICE=orades
                                                 XDB)

If I go:
SQL> alter system set dispatchers='(pro=tcp)(service=oradesXDB),(pro=tcp)(disp=1)';
alter system set dispatchers='(pro=tcp)(service=oradesXDB),(pro=tcp)(disp=1)'
*
ERROR at line 1:
ORA-00101: invalid specification for system parameter DISPATCHERS

which seems to be the documented way do add 1 more dispatcher, it doesn't work.

Any help ?
 

Tom Kyte
April 05, 2004 - 5:18 pm UTC

where did you see it documented like that?

and have you read through the net services admin guide?

mts

A reader, April 05, 2004 - 2:57 pm UTC

if i have shared server enabled, which is the default in tnsnames.ora if i do not specify ?

(server=dedicated) or (server=shared) ?

Tom Kyte
April 05, 2004 - 5:22 pm UTC

depends on the service you connect to. the service drives that.