Skip to Main Content
  • Questions
  • Poor Response while working in MTS mode.

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Anil Kumar.

Asked: September 04, 2002 - 9:30 am UTC

Last updated: April 28, 2008 - 11:38 am UTC

Version: 8.1.6

Viewed 1000+ times

You Asked

HI Tom,

Sub : Poor Response while working in MTS mode.

We have 8i 8.1.6 installation on NT plateform and Oracle database is configured to run in MTS mode. We are 25 concurrent users at present but expected to grow up to 250. Local naming method of NET8 is followed to connect to Oracle server in a switched ethernet LAN.

My question is after connecting to a database in a LAN, users face delay in getting response most of the times even for smaller data volume. In general, delay is around about one or one and one half minutes. Only few times, we get prompt response but not always. Our SGA is properly sized and there is no contention in harddisks. Also, all objects in the database are properly tuned. I personnely feel that MTS performance at our end does not seem to be proper or we have not configured MTS for best performance.

Can you suggest any remedial solution to this ?

Followings are our initialization parameters used for MTS.

MTS_DISPATCHERS = "(PROTOCOL=TCP)(PRE=Oracle.aurora.server.SGiopServer)(MUL=ON)"
SHARED_POOL_SIZE = 152428800
LARGE_POOL_SIZE = 31457280
SORT_AREA_SIZE = 65536
SORT_AREA_RETAINED_SIZE = 65536

There is no mts_max_dispatchers, mts_servers & mts_max_servers defined. Meaning that we have retained default one dispatcher and one shared server. Session Data Unit (SDU) buffer size has not been efined in a client as well as server tnsnames.ora resulting efault SDU buffer size of 2048. I have also verified the available MTS performance views but could not conclude anything.

Following are tnsnames.ora files for SERVER & CLIENT respectively.

1. SERVER tnsnames.ora

# TNSNAMES.ORA Network Configuration File: D:\Oracle\Ora81\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

GEB.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = NMP)(Server = NF5000)(Pipe = ORAPIPE))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)

GEBTCP.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = nf5000)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)

ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = nf5000)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)


2. CLIENT tnsnames.ora

# C:\FORMS6I\NET80\ADMIN\TNSNAMES.ORA Configuration File:C:\forms6i\net80\admin\tnsnames.ora
# Generated by Oracle Net8 Assistant

GEB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = nf5000)(PORT = 1521))
(CONNECT_DATA = (SID = ORCL))
)

EXAMPLE3.WORLD =
(DESCRIPTION =
(ADDRESS = (COMMUNITY = nmp.world)(PROTOCOL = NMP)(Server = FinanceServer1)(Pipe = ORAPIPE))
(CONNECT_DATA = (SID = ORCL))
)

EXAMPLE1.WORLD =
(DESCRIPTION =
(ADDRESS = (COMMUNITY = tcp.world)(PROTOCOL = TCP)(Host = Production1)(Port = 1521))
(CONNECT_DATA = (SID = SID1))
)

BEQ-LOCAL.WORLD =
(DESCRIPTION =
(ADDRESS = (COMMUNITY = beq.world)(PROTOCOL = BEQ)(PROGRAM = oracle73)(ARGV0 = oracle73ORCL)(ARGS = '(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))'))
(CONNECT_DATA = (SID = ORCL))
)

EXAMPLE2.WORLD =
(DESCRIPTION =
(ADDRESS = (COMMUNITY = spx.world)(PROTOCOL = SPX)(Service = Server_lsnr))
(CONNECT_DATA = (SID = ORCL))
)

TCP-LOOPBACK.WORLD =
(DESCRIPTION =
(ADDRESS = (COMMUNITY = tcp.world)(PROTOCOL = TCP)(Host = 127.0.0.1)(Port = 1521))
(CONNECT_DATA = (SID = ORCL))
)


3. SERVER sqlnet.ora

# SQLNET.ORA Network Configuration File: D:\Oracle\Ora81\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES)

4. CLIENT sqlnet.ora

AUTOMATIC_IPC = OFF
TRACE_LEVEL_CLIENT = OFF
names.directory_path = (TNSNAMES)
names.default_domain = world
name.default_zone = world




and Tom said...

one shared server -- think about it.

25 people. All ask to do something that takes 5 seconds.

Hmmm... what happens? the first guy gets his answer in 5 seconds, second in 10, third in 15, ..... the poor 10th guy is 50 seconds, 20th guy 100 seconds and so on.


Sound like you have INSUFFICIENTLY configured your shared servers for your concurrent usage doesn't it??? You have one server serving everyone.


Unless you have a real reason to use MTS -- don't. 250 users is *tiny*. No need for MTS there. Just use dedicated server.

Rating

  (22 ratings)

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

Comments

Is this correct for MTS

subbu, March 18, 2003 - 9:07 pm UTC

i got that 250 is tiny. I'm having a server with 7 database instances(databases and not in OPS) having the following load 500+600+50+50+20+10+2 = 1232 users using a single listener. Can i go for MTS configuration for the databases where the no. of users are 500 and 600? Considering my server is having 8 CPU and 8GB ram on E10k?

Is going for MTS is only related to resource availability then can you tell how much resource is normally required for a dedicated connection?
thanks

Tom Kyte
March 19, 2003 - 6:25 am UTC

oh yuck. hate that "more then one instance on a server" concept. why don't you consolidate them all -- it is more manageable, more secure, more everything.


Yes, using MTS would be something to consider here (moving to a single instance would be my first consideration). 8 cpu is on the low side here for that many concurrently connected users.


A dedicated server connection consumes an OS process. Each process has its own PGA. Using MTS serves three primary purposes:

o process reduction, less context switching between OS level processes in the OS itself

o slight memory reduction, by removing the now redundant PGA allocations

o maximum active session control -- you'll never have more then N active sessions where N = max shared servers. If all 1,232 users hit the "go" button using dedicated server -- the machine would fall over, get swamped. Using MTS, some would just wait a tad longer then others but everything would proceed in an organized manner.

A reader, March 20, 2003 - 8:00 pm UTC


Very useful

Bruno Di Rei Araujo, May 19, 2003 - 9:20 am UTC

Thanks for this explanation Tom !

Although I have a small server and small # of clients, I figured out that MTS would be better to my case based in your answer!

Thank you a lot !

Can u bit more explainatory ?

Anu, December 04, 2003 - 4:49 am UTC

you said "one shared server -- think about it.". u also said go for dedicated configuration. but 250+ users going for dedicated ? more user better to go for MTS. what u say?


Tom Kyte
December 04, 2003 - 8:42 am UTC

one shared server (one thing at a time in the database, no concurrency)

PLUS

25 users

EQUALS
----------------

nothing getting done. it is pure math here.



250 users is tiny, small. the smallest of database servers today should handle that fine


shared server is for why you absolutely cannot get another process/thread created on the system (totally maxed out) and you need to get one more user logged in.



Poor Response

AnilKumar Deshmukh, December 07, 2003 - 11:23 am UTC

HI Tom,

Thanks for a nice reply & explanations.



Yet Again!!!!!!

A reader, May 21, 2004 - 11:01 pm UTC

Hi Tom,
We have Shared Server architecture configured on Oracle 9iR2. We have a at least 10 Java connections which connects to the database and runs all the time and does huge amount of inserts (OLTP), until it is stopped manually. There are also users who connect through the internet for normal queries and nominal inserts. During peak times the system gets slow and disconnections mount. it is generally around 8PM. Should we change it to dedicated server mode or could there be other possible reasons?
Also Shared Server is good for OLTP or others like DSS and DW can benefit from it also.
Thanks as always :)

Tom Kyte
May 22, 2004 - 4:48 pm UTC

is the java already using a connection pool? are we client server here? not really sure of your architecture and without that knowledge, no one could say anything.

Sorry Tom.............

A reader, May 25, 2004 - 10:25 am UTC

Sorry for the incomplete information.
The clients connect to the Oracle Server using this Java procedures which run on the Server itself. The clients are machines which connect to the Oracle Server using WAN to these Java procedures and connect to the Database and carry on the transaction. I am not sure about connection pooling and could you help me how to confirm if it is being used?
Hope this helps.
Thanks again.


Tom Kyte
May 25, 2004 - 11:15 am UTC

you would ask the java coders to describe the architecture, they would know.

connection pooling OR shared server

reader, May 25, 2004 - 12:57 pm UTC

When one could implement connection pooling at the middle tier using dedicated server processes on the server, why would one need to consider shared server architecture? What is the need for shared server architecture as I can scale up using connection pooling? Thanks.

Tom Kyte
May 25, 2004 - 12:59 pm UTC

they would not. if you are doing middle tier connection pooling, you don't want to do shared server on the database.

Missing Info!!!!!!!!!!

A reader, May 26, 2004 - 9:29 pm UTC

Hi Tom,
>>Sorry for the incomplete information.
The clients connect to the Oracle Server using this Java procedures which run on
the Server itself. The clients are machines which connect to the Oracle Server
using WAN to these Java procedures and connect to the Database and carry on the
transaction. I am not sure about connection pooling and could you help me how to
confirm if it is being used?
Hope this helps.
Thanks again.

Followup:
you would ask the Java coders to describe the architecture, they would know.
>>

I have confirmed from the Java developers and yes we are using Connection Pooling.
So I hope now you can answer my query that should I change to dedicated server mode or stick to shared server architecture.
Thanks as always :)


Tom Kyte
May 27, 2004 - 8:54 am UTC

if they are using a connection pool, there is no good reason to use shared server. The goal of shared server is already being accomplished by the connection pool and since a shared server connection is by design "slower" than a dedicated server (more stuff goes on, more complex) it is most likely only getting in the way.

Thanks Tom.....

A reader, May 27, 2004 - 4:18 pm UTC

hi Tom,
You clarified my queries. I was thinking the same too. But I just got myself thinking what if we disabled the pooling in Java and let the shared server do its job. As I have to set all the parameters of max_disaptchers and max_shared_servers to 0 and bounce the database.
What do you think about it?
Also I know that Dedicated Server mode can be activated using services but I have no idea how to implement it in the Java code while connecting to the database.
Kindly shed some light
Thanks again and again and again and ..............
:D


Tom Kyte
May 27, 2004 - 8:43 pm UTC

then your java would be connect/disconnect/connect/disconnect/connect.......


dedicate/shared server is set in the tns setup, nothing to do with java at all. if you just don't set up shared server or put server=dedicated in the tns connect string, it'll just happen.

nice discussion

MEHMOOD, May 28, 2004 - 12:39 am UTC

Very nice and helpfull discussion. One can know many things having read this discussion.

Point Taken!!!!!!!!!

A reader, May 28, 2004 - 12:06 pm UTC

Hi Tom,
I understood what you mean. I think it is better to change to Dedicated Server rather than disabling the Connection Pooling in the Java Programs.
But as you said that:
>>>>>>>>>>>>>
if you just don't set up shared server or put server=dedicated in the tns
connect string, it'll just happen.
>>>>>>>>>>>>>
I think I am a just bit confused. I am aware of the fact that the services can be set to Dedicated or Shared. In fact I have already one of that for RMAN connection. But while connecting to the Database it is not necessary to supply a Host string if connecting to the local server. And the Java Programs are run on the Local Server where the Database is installed.
So how do I go about it.
Thanks as always


Tom Kyte
May 28, 2004 - 1:20 pm UTC

the tnsnames.ora connect string -- it could have server=dedicated or server=shared in it (in the file) to specify which you want.

I understood!!

A reader, May 31, 2004 - 1:43 pm UTC

Hi Tom,
I know that it can be done in the service names, I already use that for RMAN. But the problem is there are 2 types of JAVA programs. One version is new and the other one is old. The old ones do not use Connection Pooling so for that we need to use Shared Server. And also we cannot change the code due to some reason I fail to understand. So we need like 2 services one with Shared Server for the old ones and Dedicated Server for the new ones.
How do I solve this dilema. I have presently changed all the services to Dedicated Server mode. This morning the developers told me this news. So how do I solve this issue?
Also, I tried using the service names in the connection string in Java but it failed.
Any ideas will be welcome as always.

Tom Kyte
May 31, 2004 - 2:57 pm UTC

have you been experiencing a performance issue that you have tied into using shared server? if not, don't change.

else, people using shared server would use "connect string 1" and people using dedicated server would have to use "connect string 2"

Thanks Tom..

A reader, May 31, 2004 - 3:34 pm UTC

Thanks for the prompt reply Tom.
I just want to try out with Dedicated server mode to see the performance. At present there are a lot of disconnections during peak times. And you said that Shared Server and Connection Pooling in Java maybe the problem.
So just to be sure.
Tom can you please help me how to connect to the database using connect strings in Java. At present the Java developers cannot achieve this.
The present connection format in Java is as follows:

jdbc:oracle:thin:@"+connectURL+":1521:sid",user,password

where connectURL is the IP address of the Server on which Oracle is installed.
So how can a connection using connect string be achieved using Java.
Please help.



Tom Kyte
May 31, 2004 - 3:54 pm UTC

if you have lots of connect/disconnect -- shared server will have an advantage.


Connection conn = null;
OracleCallableStatement stmt = null;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String cstring = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)"+
"(HOST=localhost)(PORT=1521)))"+
"(CONNECT_DATA=(SERVER=shared)"+
"(SERVICE_NAME=ora9ir2XDB)))";

conn = DriverManager.getConnection(
"jdbc:oracle:thin:@" + cstring, "scott", "tiger" );
System.out.println( "I'm in with "+ cstring );


for example.

Thanks Tom

A reader, May 31, 2004 - 4:04 pm UTC


More questions about pool response with MTS mode

A reader, October 23, 2004 - 1:01 pm UTC

Tom,

At the beginning of this thread, you have a comment of

"
one shared server -- think about it.

25 people. All ask to do something that takes 5 seconds.

Hmmm... what happens? the first guy gets his answer in 5 seconds, second in 10,
third in 15, ..... the poor 10th guy is 50 seconds, 20th guy 100 seconds and so
on.
"

I get a little confused by your comments here. As my understanding about MTS configuration, we will have one shared server and multiple dispatchers as well as multiple shared server processes to serve user connections and requests.

1. In your comments, you mean 'one shared server' or 'one shared server process'? As long as Oracle has multiple shared processes to serve user's requests, the user's requests can be served parallelly by those shared server processes. So it should not be wait so long as you mentioned here.

2. If one shared server for 25 people/connections is not adquate, how can a MTS mode serves thousands of connetions?

3. How to find out how many shared servers in the MTS mode? Does the 'show parameter mts_servers' tell me the actual number of shared server?

4. How to find out how many shared server processes Oracle allocated in the MTS mode? In your book, you mentioned it was a fixed number. It is platform dependent or not?

Thanks as always

Tom Kyte
October 23, 2004 - 2:11 pm UTC

they said "we have one dispatcher" (that is OK, that is fine) "we have ONE shared server" -- that is not so good.

to me, one shared server is unambigous -- they have one shared server for all users to share.


My point was -- if you have ONE, just ONE -- that isn't going to work very good. One person doing something that takes a second or two or three is going to totally gum up the works (think about it).

You want about as many shared servers as you have concurrently active users. In the golden age of client server way back when -- you might have 100 users connected to the database from 9-5, but at any point in time, only 5 or 6 of them were actually ACTIVE. In this case, 5 or 6 shared servers would be perfect.

the documentation describes the defaults and a show parameter would show you as well. if a parameter is OS dependent, the documentation will point that out as well. See the Reference guide, you'll find them all in there.

Still don't get it

A reader, October 23, 2004 - 8:36 pm UTC

Tom,

I still don't get it. I agree with you at "if you have ONE, just ONE -- that isn't going to work very good." But it seems to me this situation is impossible at real STM configuration. They said they used the default configuration of mts_max_dispatchers, mts_servers and mts_max_servers parameters, which means the instance starts up with one shared server process. But when user connections/requests increase (say, they have 25 connections), Oracle will add more shared server processes to serve. When system load decreases or has no connection, Oracle only maintains one shared server process. So how is it possible to have one and only one server process to work all time?

Tom Kyte
October 23, 2004 - 9:32 pm UTC

they said they had one, i took them at their word.


MTS or dedicated

A reader, December 29, 2004 - 10:49 am UTC

I have one instance in dedicated server mode with average of 250 sessions (select count(*) from v$session) during the day.

I am evaluating whether to move to MTS primarily because there are many many sessions that connect and disconnect constantly. The Oracle/OS overhead of setting up a dedicated server process for each of these sessions would be high, right?

If I tail -f ?/network/log/listener.log, it is constantly busy.

How can I quantify this stuff? i.e. if my server is getting bogged down with all these connection requests? No one has complained so far, but maybe I am lucky to have tolerant users :)

Although when I do sqlplus user/pw@database, it takes a noticeable while to connect (3-4 seconds)

Thanks for any help

Tom Kyte
December 29, 2004 - 5:14 pm UTC

MTS will most likely in this case speed up the relative connection time, but slow down overall processing.

so, if the connect/disconnect cycle includes very little work in between (eg: a cgi-bin program generating a web page that connects, generates page in 0.5 seconds, disconnects) you'd see a benefit.

However, if there is substantial work involved, such that the connect portion of the session is really small -- then you would probably see a negative benefit for the code path for MTS (shared server) is much longer. Unless the machine is totally CPU starved right now -- you might well see an overall decrease in response times.

dedicated server conversation:

client says right to dedicated server -- run this query, give me the answer. it happens.

shared server conversation:

client says to dispatcher -- get this query run please. Dispatcher takes query places it on a queue in the SGA. First shared server that notices it picks it up and runs it. Shared server places response back into the queue, dispatcher sees it and gives it back to client (remember, this goes on for each subsequent FETCH call too!)



but, if you were cpu starved and context switching like mad -- the dedicated server connection could be running at a slow speed itself, slower than the extra work that shared server would impose. therefore, lightening up the load on the server could be beneficial....


so, you need to look at the overall machine here before seeing if you want to even play with this.

Thanks

A reader, December 29, 2004 - 5:30 pm UTC

This is a Solaris box. 'top' shows the CPU always 50% idle or so. ps -ef|grep oracle$ORACLE_SID|wc -l is close to 250 or so, machine is not swapping or paging (sar -g and sar -w are clean) so I am nowhere near exhausting OS resources.

So I guess I'll just leave this alone

Thanks for the explanation on shared server architecture

Listener

A reader, December 31, 2004 - 9:17 am UTC

How about the listener? Regardless of dedicated or MTS, all connections go to good ol port 1521.

Is there a way to find out if port 1521 is getting more work than it can handle? Any way to do load balancing/sharing here?

Thanks

Tom Kyte
December 31, 2004 - 11:21 am UTC

but the connections are so so short, shorter than an HTML request (port 80).

sure, you can fire up multiple listeners, on different ports -- on different machines even -- but if your web server can deal with it....


until you show me a burned out port 1521, don't do anything about it.

A reader, December 31, 2004 - 2:03 pm UTC

"until you show me a burned out port 1521"

thats the thing, how can I measure if the port is indeed "burned out"? If a connection to Oracle is slowing down, it could be one of 4 things
a) network
b) port 1521
c) listener
d) dedicated vs MTS

how can I narrow it down definitively to one of these 4?

Tom Kyte
December 31, 2004 - 2:35 pm UTC

unless you are literally doing hundreds of connects per second (and the process creation, sesssion establishment for that), it won't be the listener getting burnt out.

You won't be able to create processes that fast in dedicated server mode.
You won't be able to establish sessions that fast in shared server mode.


Let's put it this way - if you were to burn out 1521 -- you have serious problems elsewhere that would have manifested themselves first :)

think about the situation you'd have to be in to swamp that port -- hundreds, thousands of simultaneous "connect me" requests. other stuff breaks way before this.

pradeepa, April 24, 2008 - 6:29 am UTC

"client says to dispatcher -- get this query run please. Dispatcher takes query places it on a
queue in the SGA. First shared server that notices it picks it up and runs it. Shared server
places response back into the queue, dispatcher sees it and gives it back to client (remember, this
goes on for each subsequent FETCH call too!)"

in above statement you mentioned that subsequent fetch for same query might use different shared server.
how the subsequent server knows the state of cursor? whether is it a new query to be executed or rows are already fetched?
Tom Kyte
April 28, 2008 - 11:38 am UTC

... how the subsequent server knows the state of cursor? whether is it a new query
to be executed or rows are already fetched? ...

that is part of your session state, stored in the UGA (user global area) which is in the SGA when you connect via shared server (and in the PGA when you connect via dedicated server)