Hi
I need to increase performance of our SQL enviroment and i dont really want
to put one BIG server in.
What would be the best way of load balancing 1 SQL database over 2 servers?
My first thought was 2 servers clustered with a SAN and use SQL replication
between two differant Instances, is this possible or is there a better way?
Thanks
Andy
SQL 2000 can't not be load balanced for a single database. A database can
only be run from one server at a time. Sorry.
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://www.msmvps.com/clustering - Blog
"Andrew Gilbert" <AndrewGilbert@.discussions.microsoft.com> wrote in message
news:7CCD89F6-9AAA-4F49-A77B-095B809384AC@.microsoft.com...
> Hi
> I need to increase performance of our SQL enviroment and i dont really
> want
> to put one BIG server in.
> What would be the best way of load balancing 1 SQL database over 2
> servers?
> My first thought was 2 servers clustered with a SAN and use SQL
> replication
> between two differant Instances, is this possible or is there a better
> way?
> Thanks
> Andy
|||Hi
Using replication is possible, but your application has to understand that
records can be inserted in different databases, so if any identity columns
exist, expect issues.
SQL Server can not be directly load balanced. Don't forget, a SAN may not
make IO quicker, it might actually be a lot slower (compared to local
storage).
What is your current hardware setup, DB sizes, transactions per minute and
what performance are you expecting?
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Andrew Gilbert" <AndrewGilbert@.discussions.microsoft.com> wrote in message
news:7CCD89F6-9AAA-4F49-A77B-095B809384AC@.microsoft.com...
> Hi
> I need to increase performance of our SQL enviroment and i dont really
want
> to put one BIG server in.
> What would be the best way of load balancing 1 SQL database over 2
servers?
> My first thought was 2 servers clustered with a SAN and use SQL
replication
> between two differant Instances, is this possible or is there a better
way?
> Thanks
> Andy
|||Hi
We currently have a HP DL380 with 2x Zeaon 2.8Ghz processors and 2GB RAM
we have 2 DB and all Logs on one set of RAID 5 10k DIsks and the Main DB on
its own Mirrored set of 10K Disks.
We are experiancing High Disk Queue lengths on the first set of Disk, so we
was looking to use a HP MSA500 SAN and split all DB and Logs onto seperate
Mirrored Disks?
The Main DB is 500mb and the other DB which is used for referance info is
1.3GB
We have about 180 users using the system and we seem to be getting slow
query times in peak load, i.e 400 - 1000ms query times.
If you have any suggestion then please let me know, would a MSA500 be a bad
idea?
Andy
"Mike Epprecht (SQL MVP)" wrote:
> Hi
> Using replication is possible, but your application has to understand that
> records can be inserted in different databases, so if any identity columns
> exist, expect issues.
> SQL Server can not be directly load balanced. Don't forget, a SAN may not
> make IO quicker, it might actually be a lot slower (compared to local
> storage).
> What is your current hardware setup, DB sizes, transactions per minute and
> what performance are you expecting?
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Andrew Gilbert" <AndrewGilbert@.discussions.microsoft.com> wrote in message
> news:7CCD89F6-9AAA-4F49-A77B-095B809384AC@.microsoft.com...
> want
> servers?
> replication
> way?
>
>
|||While I am unfamiliar with the specific hardware you are considering, the
general idea of separate physical devices for Data and Log is a fundamental
key for increasing performance. Avoid RAID-5 even in a SAN for transaction
log devices. Larger write cache in a SAN device will lead to increased SQL
performance. Check and see if the high queue lengths are for read or for
write operations. If they are for read requests, increasing the RAM (and
moving to Enterprise SQL) may result in more performance improvements than
you would get through disk subsystem changes. Of course, the ideas are not
mutually exclusive.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Andrew Gilbert" <AndrewGilbert@.discussions.microsoft.com> wrote in message
news:7B0503A3-DB49-4E1B-8D12-E2542575690B@.microsoft.com...
> Hi
> We currently have a HP DL380 with 2x Zeaon 2.8Ghz processors and 2GB RAM
> we have 2 DB and all Logs on one set of RAID 5 10k DIsks and the Main DB
on
> its own Mirrored set of 10K Disks.
> We are experiancing High Disk Queue lengths on the first set of Disk, so
we
> was looking to use a HP MSA500 SAN and split all DB and Logs onto seperate
> Mirrored Disks?
> The Main DB is 500mb and the other DB which is used for referance info is
> 1.3GB
> We have about 180 users using the system and we seem to be getting slow
> query times in peak load, i.e 400 - 1000ms query times.
> If you have any suggestion then please let me know, would a MSA500 be a
bad[vbcol=seagreen]
> idea?
> Andy
> "Mike Epprecht (SQL MVP)" wrote:
that[vbcol=seagreen]
columns[vbcol=seagreen]
not[vbcol=seagreen]
and[vbcol=seagreen]
message[vbcol=seagreen]
sql
Showing posts with label servers. Show all posts
Showing posts with label servers. Show all posts
Friday, March 30, 2012
Monday, March 12, 2012
Inconsistent SP performance on different Servers
One of my developers recently installed a backup of the production database onto his test site. His test server has the same configuration as the production server.
One of the Stored Procedures that is called takes 1:45 to run on his machine, but only 2 seconds on the production server. This same SP takes only 2 seconds on my development database.
The SP is called iteratively, up to 10 times... to run against 10 separate fields. Depending on a value for a parameter called @.CriteriaClassID, depends on which portion of the SP runs.
The significant difference in processing time in itself is baffling (since the servers are same specs / configuration, as far as I can tell, and the data is identical, since he has a backup of the most recent production data).
But more baffling: if, in his data, I switch the values from field 1 to field 2, and vice versa, his results take 2 seconds (switching the values in field 1 to field 2 switches the value in @.CriteriaClassID which is passed through to this SP).
It's exactly the same SP; the only difference is that field 1 is processed first, field 2 second, field 3 third etc. On the production site and my development site, it doesn't make a difference in the order they are processed. On his machine it does.
Any ideas? I though perhaps his Indexes were corrupted in the rebuild, but we ran a SQL Server maintenance schedule to clean it up, and no improvement.
This is the SP, if it is of any help:
CREATE procedure [dbo].[st_pull_model_data] @.ModelID as integer, @.CriteriaID as integer
as
declare @.ClientID as integer, @.CriteriaClassId as char(1)
/*Procedure to pull data from org_model_data and postalcode_model_data for modeling and media analysis */
/*Need to have table #temp_data created outside of SP with fields org_id and zip_code */
/*This procedure is used by SP st_model_data */
If @.CriteriaID is not null
begin
set @.CriteriaClassId = (Select model_criteria_type from model_criteria where model_criteria_id = @.CriteriaID)
if @.CriteriaClassID = 'G' -- changes client_id from specific to general, if General is required.
begin
set @.ClientID = 0
end
else
begin
set @.ClientID = (Select client_id from model where model_id = @.ModelID)
end
If @.CriteriaClassId in ('G','P')
Begin
update #temp_data
set data1 = postal_criteria_value
from #temp_data t
left outer join
(select postalcode, postal_criteria_value
from postalcode_model_data pmd
join model_org_trade_area mota on mota.zip_code = pmd.postalcode
join model_org mo on mo.model_org_id = mota.model_org_id
where model_criteria_id = @.CriteriaID
and client_id = @.ClientID
and mo.model_id = @.ModelID) as PMD
on PMD.postalcode = t.zip_code
end
else
Begin
update #temp_data
set data1 = org_criteria_value
from #temp_data t
left outer join
(select distinct postalcode, org_criteria_value, omd.org_id
from org_model_data omd
join org o on o.org_id = omd.org_id
join model_org_trade_area mota on mota.zip_code = omd.postalcode
join model_org mo on mo.model_org_id = mota.model_org_id and mo.org_id = o.org_id
where model_criteria_id = @.CriteriaID and o.client_id = @.ClientID and mo.model_id = @.ModelID) as OMD
on OMD.postalcode = t.zip_code and omd.org_id = t.org_id
end
endJust a thought on something to try...
Declare two local variables that are similar to the two passed in parameters, copy the parameters to these local variables at the top of your sporc and then use the local variables only within the code.
If this has the effect of solving your issue, you have a "parameter sniffing" issue.|||One other thought, is his tempdb on the same physical disk as the database data files? It won't explain the whole performance problem, but it will explain a part.|||Chopin,
Thanks a ton. The inclusion of the two local variables (copying over the SP variables) solved the problem for performance.
Another lesson learned.|||In that case does that mean backup restore do not restore query plans for the stored proc in the database? Any idea?|||NO ... backup does not save the procedure cache.
One of the Stored Procedures that is called takes 1:45 to run on his machine, but only 2 seconds on the production server. This same SP takes only 2 seconds on my development database.
The SP is called iteratively, up to 10 times... to run against 10 separate fields. Depending on a value for a parameter called @.CriteriaClassID, depends on which portion of the SP runs.
The significant difference in processing time in itself is baffling (since the servers are same specs / configuration, as far as I can tell, and the data is identical, since he has a backup of the most recent production data).
But more baffling: if, in his data, I switch the values from field 1 to field 2, and vice versa, his results take 2 seconds (switching the values in field 1 to field 2 switches the value in @.CriteriaClassID which is passed through to this SP).
It's exactly the same SP; the only difference is that field 1 is processed first, field 2 second, field 3 third etc. On the production site and my development site, it doesn't make a difference in the order they are processed. On his machine it does.
Any ideas? I though perhaps his Indexes were corrupted in the rebuild, but we ran a SQL Server maintenance schedule to clean it up, and no improvement.
This is the SP, if it is of any help:
CREATE procedure [dbo].[st_pull_model_data] @.ModelID as integer, @.CriteriaID as integer
as
declare @.ClientID as integer, @.CriteriaClassId as char(1)
/*Procedure to pull data from org_model_data and postalcode_model_data for modeling and media analysis */
/*Need to have table #temp_data created outside of SP with fields org_id and zip_code */
/*This procedure is used by SP st_model_data */
If @.CriteriaID is not null
begin
set @.CriteriaClassId = (Select model_criteria_type from model_criteria where model_criteria_id = @.CriteriaID)
if @.CriteriaClassID = 'G' -- changes client_id from specific to general, if General is required.
begin
set @.ClientID = 0
end
else
begin
set @.ClientID = (Select client_id from model where model_id = @.ModelID)
end
If @.CriteriaClassId in ('G','P')
Begin
update #temp_data
set data1 = postal_criteria_value
from #temp_data t
left outer join
(select postalcode, postal_criteria_value
from postalcode_model_data pmd
join model_org_trade_area mota on mota.zip_code = pmd.postalcode
join model_org mo on mo.model_org_id = mota.model_org_id
where model_criteria_id = @.CriteriaID
and client_id = @.ClientID
and mo.model_id = @.ModelID) as PMD
on PMD.postalcode = t.zip_code
end
else
Begin
update #temp_data
set data1 = org_criteria_value
from #temp_data t
left outer join
(select distinct postalcode, org_criteria_value, omd.org_id
from org_model_data omd
join org o on o.org_id = omd.org_id
join model_org_trade_area mota on mota.zip_code = omd.postalcode
join model_org mo on mo.model_org_id = mota.model_org_id and mo.org_id = o.org_id
where model_criteria_id = @.CriteriaID and o.client_id = @.ClientID and mo.model_id = @.ModelID) as OMD
on OMD.postalcode = t.zip_code and omd.org_id = t.org_id
end
endJust a thought on something to try...
Declare two local variables that are similar to the two passed in parameters, copy the parameters to these local variables at the top of your sporc and then use the local variables only within the code.
If this has the effect of solving your issue, you have a "parameter sniffing" issue.|||One other thought, is his tempdb on the same physical disk as the database data files? It won't explain the whole performance problem, but it will explain a part.|||Chopin,
Thanks a ton. The inclusion of the two local variables (copying over the SP variables) solved the problem for performance.
Another lesson learned.|||In that case does that mean backup restore do not restore query plans for the stored proc in the database? Any idea?|||NO ... backup does not save the procedure cache.
Labels:
backup,
configuration,
database,
developers,
inconsistent,
installed,
microsoft,
mysql,
oracle,
performance,
production,
server,
servers,
sql
Inconsistent metadata. Error 7352.
Howdy all. I am getting an error with SQL Server 2000. I am pulling data from one server to another using Linked Servers. I am getting the following error:
OLE DB provider 'SQLOLEDB' supplied inconsistent metadata. The object '[<IP>].[<Database>].[dbo].[<Table>]' was missing expected column '<ColumnName>'. [SQLSTATE 42000] (Error 7352).
The perplexing thing to me about this problem, is that I am getting the error when I run a particular stored procedure within a SQL Server Agent Job. However, I run the stored procedure several times within that job, and it works the first couple of times. It fails on the same job step every time, but yet it works on other steps that do the same thing -- just with different tables and columns.
Any help would be greatly appreciated.You may have already tried this - but have you deleted the step and added the step back ?|||No, I have not tried this yet, but I will try it. I am having this problem at several servers which are all pulling from the same linked server.
Thanks for the suggestion.
Originally posted by rnealejr
You may have already tried this - but have you deleted the step and added the step back ?|||Was a column (or anything else) modified/deleted ?|||No. I thought of that, too. Nothing has been done to the table or its columns.
Originally posted by rnealejr
Was a column (or anything else) modified/deleted ?|||Let me know if deleting the step works - something may have gotten corrupted.|||I deleted the whole SQL Agent job and readded it. I am still getting the inconsistent metadata error. It happens on and off. It will work sometimes for several of the servers that are pulling data, but most of the time I get the metadata error.|||Is it the same column/table every time ? If so, what is the data type of the column ? Are you linking to sql server 2000 servers only ? Do you know where it is failing within the sp - can you post the code where it is failing ?|||It is the same table/column everytime. It is the same step in the job every time. The sp is executed several times within the job, and it works successfully several times, but when it fails it always fails on this step. Here is the code that it is failing on:
--------------
SELECT @.Command = @.Command + 'DECLARE tmpCursor CURSOR READ_ONLY FOR' + Char(13)
SELECT @.Command = @.Command + 'SELECT distinct ' + Char(13)
SELECT @.Command = @.Command + ' o.O_ID' + Char(13)
SELECT @.Command = @.Command + 'FROM' + Char(13)
SELECT @.Command = @.Command + ' [' + @.SourceServerName + '].Mugshot.dbo.Objects o,' + Char(13)
SELECT @.Command = @.Command + ' [' + @.SourceServerName + '].Mugshot.dbo.SubObjects so,' + Char(13)
SELECT @.Command = @.Command + ' [' + @.SourceServerName + '].Mugshot.dbo.FieldInstanceObjects fio,' + Char(13)
SELECT @.Command = @.Command + ' ' + @.DestImageTableName + ' i,' + Char(13)
SELECT @.Command = @.Command + ' xFer_R_ID r' + Char(13)
SELECT @.Command = @.Command + 'WHERE' + Char(13)
SELECT @.Command = @.Command + ' r.R_ID = i.Parent_R_ID AND' + Char(13)
SELECT @.Command = @.Command + ' i.' + @.DestImageColumnName + ' = fio.FI_ID AND' + Char(13)
SELECT @.Command = @.Command + ' fio.O_ID = o.O_ID AND' + Char(13)
SELECT @.Command = @.Command + ' so.Full_O_ID = o.O_ID' + Char(13)
--------------
Basically, I am declaring a cursor within a string, so the SourceServer can be dynamically specified. All SourceServer's are SQL Server 2000. I use Linked Servers to access the SourceServer's (sp_addlinkedserver).
Thanks for your time.
Originally posted by rnealejr
Is it the same column/table every time ? If so, what is the data type of the column ? Are you linking to sql server 2000 servers only ? Do you know where it is failing within the sp - can you post the code where it is failing ?
OLE DB provider 'SQLOLEDB' supplied inconsistent metadata. The object '[<IP>].[<Database>].[dbo].[<Table>]' was missing expected column '<ColumnName>'. [SQLSTATE 42000] (Error 7352).
The perplexing thing to me about this problem, is that I am getting the error when I run a particular stored procedure within a SQL Server Agent Job. However, I run the stored procedure several times within that job, and it works the first couple of times. It fails on the same job step every time, but yet it works on other steps that do the same thing -- just with different tables and columns.
Any help would be greatly appreciated.You may have already tried this - but have you deleted the step and added the step back ?|||No, I have not tried this yet, but I will try it. I am having this problem at several servers which are all pulling from the same linked server.
Thanks for the suggestion.
Originally posted by rnealejr
You may have already tried this - but have you deleted the step and added the step back ?|||Was a column (or anything else) modified/deleted ?|||No. I thought of that, too. Nothing has been done to the table or its columns.
Originally posted by rnealejr
Was a column (or anything else) modified/deleted ?|||Let me know if deleting the step works - something may have gotten corrupted.|||I deleted the whole SQL Agent job and readded it. I am still getting the inconsistent metadata error. It happens on and off. It will work sometimes for several of the servers that are pulling data, but most of the time I get the metadata error.|||Is it the same column/table every time ? If so, what is the data type of the column ? Are you linking to sql server 2000 servers only ? Do you know where it is failing within the sp - can you post the code where it is failing ?|||It is the same table/column everytime. It is the same step in the job every time. The sp is executed several times within the job, and it works successfully several times, but when it fails it always fails on this step. Here is the code that it is failing on:
--------------
SELECT @.Command = @.Command + 'DECLARE tmpCursor CURSOR READ_ONLY FOR' + Char(13)
SELECT @.Command = @.Command + 'SELECT distinct ' + Char(13)
SELECT @.Command = @.Command + ' o.O_ID' + Char(13)
SELECT @.Command = @.Command + 'FROM' + Char(13)
SELECT @.Command = @.Command + ' [' + @.SourceServerName + '].Mugshot.dbo.Objects o,' + Char(13)
SELECT @.Command = @.Command + ' [' + @.SourceServerName + '].Mugshot.dbo.SubObjects so,' + Char(13)
SELECT @.Command = @.Command + ' [' + @.SourceServerName + '].Mugshot.dbo.FieldInstanceObjects fio,' + Char(13)
SELECT @.Command = @.Command + ' ' + @.DestImageTableName + ' i,' + Char(13)
SELECT @.Command = @.Command + ' xFer_R_ID r' + Char(13)
SELECT @.Command = @.Command + 'WHERE' + Char(13)
SELECT @.Command = @.Command + ' r.R_ID = i.Parent_R_ID AND' + Char(13)
SELECT @.Command = @.Command + ' i.' + @.DestImageColumnName + ' = fio.FI_ID AND' + Char(13)
SELECT @.Command = @.Command + ' fio.O_ID = o.O_ID AND' + Char(13)
SELECT @.Command = @.Command + ' so.Full_O_ID = o.O_ID' + Char(13)
--------------
Basically, I am declaring a cursor within a string, so the SourceServer can be dynamically specified. All SourceServer's are SQL Server 2000. I use Linked Servers to access the SourceServer's (sp_addlinkedserver).
Thanks for your time.
Originally posted by rnealejr
Is it the same column/table every time ? If so, what is the data type of the column ? Are you linking to sql server 2000 servers only ? Do you know where it is failing within the sp - can you post the code where it is failing ?
Subscribe to:
Posts (Atom)