Showing posts with label queries. Show all posts
Showing posts with label queries. Show all posts

Sunday, March 25, 2012

Connection Pooling on Analysis Services

Please may I have your assistance with the following issue. Let me 1st describe the scenario. The front end uses BEA Web Logic which queries an IIS Web Service that in turns queries MS Analysis Services 2005.

The Web Service builds the MDX queries dynamically and returns the results in XML.

Each time we run a query we open a connection using ADOMD, fire the MDX to return the result set then close the connection. However we don't think this will provide the best performance. So

1. Does the AS OLEDB provider handle connection pooling internally?

2. If not, is it possible to implement connection pooling in code inside our web service?

3. Are there other ways to implement connection pooling? for example does using HTTP connections automatically provide us with connection pooling?

Thanks

Here is an article about implementing connection pooling in AS2000, the same should apply for AS2005.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/sql2k_connpooling.asp

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

Hi Edward,

Many thanks for the document. Please have a look at the following.

http://www.codecomments.com/archive364-2005-1-379959.html

What would be ideal is when the web service starts this will automatically create a fixed number of connection pools to an AS Db

Our objective is to be able to reuse these connection pools by different users connecting to the same web service, obviously not simultaneously. The above suggests that the connection pool is destroyed?

Any thoughts would be greatly appreciated

Thanks

John

|||

No.

The post you mention suggests only that you should apply a bit more logic beyond simple 3 step;

1. Application starts.
2. It creates pool of open connecitions size N.
3. Pool of connections is destroyed when you shut down your web service.

It suggests you implement logic in your application that allows your application to grow conneciton pool above pre-set limit N:
In beginning your conneciton pool is N , if application used all of the connections from the conneciton pool and still needs more connections, connection pool will grow to N +x ... Your application will periodically check if it needs to srink connection pool back to N.

As for the different users connecting to your application. You can re-use connections if application is using same credentials to retrevie data from Analysis Server.
For instance if user A and B connecting to your web service running under W credentials. If your connections are opened under W , you can re-use them . If you open connections under A , you should not let B re-use that conneciton , otherwize you might show B too much data.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

Hi Edward, Many thanks for your tips and based on your recommendation (to pursue AS 2000) downloaded the MS XML FOR AS SDK (AS 2000) and started to look at the various options

We used the reference to this

Public Shared p As New MSXmlAnalysisSCLib.ADOConPool

p.MaxSessions = 5

cnadomd = p.GetConnection("Data Source=myASServer" & ";Provider=msolap.3; initial catalog=myASDb")

Unfortunately we dropped the above method because there are no options to use XML? This will mean we would need to read the cells and construct our own XML string

Then we looked at the option of using http connection using the latest AS 2005 connection provider which seems to be set up to use connection pooling

conn.ConnectionString = "Data Source=http://myWebServer/OLAPhttp/msmdpump.dll" & ";Provider=msolap.3; initial catalog=myASDb"

As the content of the msmdpump.ini file suggests ::

<ConfigurationSettings>

<ServerName>localhost</ServerName>

<SessionTimeout>3600</SessionTimeout>

<ConnectionPoolSize>10</ConnectionPoolSize>

<MinThreadPoolSize>1</MinThreadPoolSize>

<MaxThreadPoolSize>10</MaxThreadPoolSize>

<MaxThreadsPerClient>5</MaxThreadsPerClient>

</ConfigurationSettings>

However from perfmon as well as SQL profiler, when issuing multiple connections simultaneously using the above http method it will use the same connection Id, but create multiple ‘current user sessions’. Also the observed execution time was rather slow.

The alternative is to use the following

conn.ConnectionString = "Data Source=myASServer;Provider=msolap.3; initial catalog=myASDb"

which is observed to work correctly when we use multiple connection simultaneously and performs well.

However the issue I have with the above is where do I instantiate the above so that I can re-use the connection. I noticed in IIS we can configure application pooling.

A low level example would be greatly appreciated, if you don’t mind?

Thanks

John

|||

First you can try and increase the ConnectionPoolSize in the msmdpump.ini .

Creating a single connection and having it be reused across several sessions should have comparable or better performance to opening new TCP connections all the time.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

Sunday, February 12, 2012

Connecting to SQL Server with an alias

We have a soon-to-be legacy Sql Server called X. We have several queries on
various other servers configured to talk to X thru a linked server that go
something like:
SELECT [columnName] FROM [X].[DBName].[dbo].[TableName]
X will now be hosted on a new machine called Y.
So my question is, is there a way of aliasing our new server called "Y" so
that it can be refered to as "X"?
TIA//
I believe that you can do this using sp_addlinkedserver. Check out Books Online
(sp_addlinkedserver), the second example in the table. This suggests that you can specify some other
name for the linked server than the network name.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Chris Newby" <Chris.Newby@.Rockcreekglobal.com> wrote in message
news:%23LXjZH6FGHA.1676@.TK2MSFTNGP09.phx.gbl...
> We have a soon-to-be legacy Sql Server called X. We have several queries on various other servers
> configured to talk to X thru a linked server that go something like:
> SELECT [columnName] FROM [X].[DBName].[dbo].[TableName]
> X will now be hosted on a new machine called Y.
> So my question is, is there a way of aliasing our new server called "Y" so that it can be refered
> to as "X"?
> TIA//
>
|||So you are using a linked server to achive the connection to the server
X. Defining a server alias within the network client tool should do the
trick.
HTH, jens Suessmeyer.

Connecting to SQL Server with an alias

We have a soon-to-be legacy Sql Server called X. We have several queries on
various other servers configured to talk to X thru a linked server that go
something like:
SELECT [columnName] FROM [X].[DBName].[dbo].[TableName]
X will now be hosted on a new machine called Y.
So my question is, is there a way of aliasing our new server called "Y" so
that it can be refered to as "X"?
TIA//I believe that you can do this using sp_addlinkedserver. Check out Books Online
(sp_addlinkedserver), the second example in the table. This suggests that you can specify some other
name for the linked server than the network name.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Chris Newby" <Chris.Newby@.Rockcreekglobal.com> wrote in message
news:%23LXjZH6FGHA.1676@.TK2MSFTNGP09.phx.gbl...
> We have a soon-to-be legacy Sql Server called X. We have several queries on various other servers
> configured to talk to X thru a linked server that go something like:
> SELECT [columnName] FROM [X].[DBName].[dbo].[TableName]
> X will now be hosted on a new machine called Y.
> So my question is, is there a way of aliasing our new server called "Y" so that it can be refered
> to as "X"?
> TIA//
>|||So you are using a linked server to achive the connection to the server
X. Defining a server alias within the network client tool should do the
trick.
HTH, jens Suessmeyer.

Connecting to SQL Server with an alias

We have a soon-to-be legacy Sql Server called X. We have several queries on
various other servers configured to talk to X thru a linked server that go
something like:
SELECT [columnName] FROM [X].[DBName].[dbo].[TableName]
X will now be hosted on a new machine called Y.
So my question is, is there a way of aliasing our new server called "Y" so
that it can be refered to as "X"?
TIA//I believe that you can do this using sp_addlinkedserver. Check out Books Onl
ine
(sp_addlinkedserver), the second example in the table. This suggests that yo
u can specify some other
name for the linked server than the network name.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Chris Newby" <Chris.Newby@.Rockcreekglobal.com> wrote in message
news:%23LXjZH6FGHA.1676@.TK2MSFTNGP09.phx.gbl...
> We have a soon-to-be legacy Sql Server called X. We have several queries o
n various other servers
> configured to talk to X thru a linked server that go something like:
> SELECT [columnName] FROM [X].[DBName].[dbo].[TableName
]
> X will now be hosted on a new machine called Y.
> So my question is, is there a way of aliasing our new server called "Y" so
that it can be refered
> to as "X"?
> TIA//
>|||So you are using a linked server to achive the connection to the server
X. Defining a server alias within the network client tool should do the
trick.
HTH, jens Suessmeyer.

Connecting to SQL Server through firewall

I have a simple asp page that queries a database inside our firewall. It works fine from the inside, and only uses port 1433. But if i put it out on our web server it won't connect and tries to use ports 139 and 445. Has anybody ran across this before?
Thanks,
JohnAre those ports that you see registered with the firewall to allow traffic? You can explicitly specify the port number in your app connection string.|||I have a simple asp page that queries a database inside our firewall. It works fine from the inside, and only uses port 1433. But if i put it out on our web server it won't connect and tries to use ports 139 and 445. Has anybody ran across this before?You are using Named Pipes instead of TCP/IP for the ODBC connection on the ASP server.

-PatP|||is that in the connection string like:

Data Source=172.25.24.30:1433

or is there some other syntax.

Thanks again,

John|||You are using Named Pipes instead of TCP/IP for the ODBC connection on the ASP server.

-PatP

Do you still need to do that for a nonDSN connection?

Thanks Pat,

John|||My first guess would be to go to the ASP server, run the SQL Client Configuration to change the default connection type to TCP/IP. I think that should fix you right up.

-PatP|||Thanks for all your help. It was set to named pipes. Does anyone know if that is the default setting? I always thought the machine came up with TCP/IP as default.

Thanks again.

John|||Different MDAC, SQL Tool, etc combinations have different defaults, and some applications change the default as part of their installation (for which I'd like to fry the developer that came up with that idea!). I don't know of any way to concretely identify just how this came to be, so I just fix it when it bytes me and move on...

-PatP|||I have a similar question. I have installed MSDE 2000 on a Win2k3 Server and everything is working fine with the DB. The MSSQLSERVER servoce has been running for 60 days straight with no issue. MSDE works great. However, I cannot connect to it on port 1433 through the firewall. Using netstat I cannot see that it is not listening on port 1433. I ran the CLICONFG utility and I can see that it has TCP/IP at the top of the list with Named Pipes below it. I have other servers ( Only Win2k servers) with MSDE 200 installed and configured similarily and these servers are listening on port 1433. I looked at the registry settings and they seem OK - nothing out of place.

The DB is now in a production environment and I cannot bounce the MSSQLSERVER service till the weekend during scheduled maintenance.

How can I ensure when I stop/start the MSSQLSERVER service that it is listening on port 1433? Would it be wise using CLICONFG to remove Named Pipes (IIS is the only user of the Database) ? I would prefer not to do that as I believe that NP is faster SQLServer and IIS are on the same box.

Does the version of MDAC have anything to do with this issue?

--Steve|||I can't think of any case where Named Pipes would be faster than TCP/IP that would occur in the real world (yes, I know of a way to construct one, but it would never occur naturally).

You can certainly do as you see fit, but I would recommend using TCP/IP as your default connection type.

If you've recently applied either sp3a to SQL Server, or sp2 to Server 2k3, they will automajikally block port 1433. Read up on the service packs to determine how you want to configure your machine to accomodate the access that you need.

-PatP|||I believe that the problem was that the CLICONFIG was not what I should have been using. There is a SVRNETCN.EXE utility in the C:\Program Files\Microsoft Sql Server\80\Tools\Binn directory that is the program to use. It turns out that the box had no IPC set at all. I added TCP/IP and it won't use the new options till I bounce MSQSQLSERVER service.

--Steve