Showing posts with label huge. Show all posts
Showing posts with label huge. Show all posts

Thursday, March 29, 2012

Distributed Broker Queue Performance Issue

Hi,

We are doing a POC for transferring a huge number of messages(millions) from oner machine to another. The two approaches we are examining are MSMQ and SQL Broker. The MSMQ is set up as a remote queue on the target machine, and the source machine takes as little as 1 millisecond to send the message (using a .NET program). However, when testing on Service Broker, we find that the time taken to send message to the queue is significantly higher - like 70 millisecond. Could you please help us in understanding why this is happening?

The service broker distributed queues have been set up as per the directions in the posting at http://www.sqlservercentral.com/columnists/sindukuri/2797.asp

The source program (written in .NET) is calling a stored procedure in the source machine to write to the SSB queue. When we run SQL Trace, we find that the SP is responsible for 99% of the time taken. Here is our SP that send the message:

Declare @.ConversationHandle uniqueidentifier
Begin Dialog @.ConversationHandle
From Service SenderService
To Service 'ReceiverService'
On Contract SampleContract
WITH Encryption=off;
SEND
ON CONVERSATION @.ConversationHandle
Message Type SenderMessageType
(<<XML String>>)

Please let us know if there are any additional settings required in the Service Broker to improve its performance. Or , what are the other approaches for building a distributed SSB application?

How big are the messages?
Are you using transactional MSMQ?

70 ms per message means ~15 msgs per second, that is quite slow. The most basic setup w/o any optimization is usualy be around 200 msgs/sec (with 1k payload) and an optimal setup should drive ~4000 msgs/sec on comodity hardware (ie. .5 milliseconds per message). Of course, I'm talking fully transacted, remote delivery operations. Have you done the minimal optimizations needed for any database operations (eg. separate data and log files on separte spindles) ?

Sending one message per dialog will give you the worst performance in SSB, both on the sending side (you need to to add the cost of the END CONVERSATION messages) as well as from the point of view of processing the messages. Have a look at the slides at http://blogs.msdn.com/remusrusanu/archive/2007/04/03/orlando-slides-and-code.aspx for a comparison of one-message-per-conversation vs. resusing conversations, as well as to see the very basic optimizations you can apply to SSB operations.

Besides raw performance, the SSB semantics (dialogs/conversartions) are quite different from MSMQ. SSB provides full duplex exactly-once-in-order reliable delivery with well defined error semantics, while MSMQ provides just raw messaging (think TCP vs. UDP if you're familiar with IP network programming).|||

The messages are close to 1 K - these are simple XML strings. We are using transactional MSMQ, and transactional SSB. These transactions are created within the .NET program, and the SQL Stored Procedure does not contain any transactions. The logic is very simple - we have a loop in C#, that reads data from anothe table (and stores in a datareader), create XML representation of that data, and calls a Stored Procedure which contains the Send Statement. I examined the links that you provided - I understand that it is possible to delay the Commit by using loop counts. However, in our case, since there are separate transactions for each message, what we can do to improve throughput?

Regards

Prasanth

|||The problem is your performance of communicating from .Net application to SQL Server. You basically cannot feed more than 15 messages per second (15 T-SQL batches), so SSB has nothing else to transmit more than 15 messages per second. Anything you can do improve this will help the message rate: cumulate several calls into a single one to reduce the number of round trips, use parametrized queries, anything that applies generic .Net T-SQL programming applies to SSB as well.
If you cannot reduce the number of transaction commits, a faster spindle for the database LDF will help. Of course, separate MDF and LDF on separate spindles.

Friday, March 9, 2012

Displaying huge heirarchial data in reports

I need to display huge data around 1 million records in report. Data needs to be represented as heirarchial. So there is somewhere around 6 level of grouping of data. Can somebody suggest a solution to get the data and display the data in a faster way.

Thanks in advance.

SSRS

Hi,

I don't knw if I understand your problem but you could use the document map functionnality for every level of grouping you have.

HTH,

Eric

|||

Hi Eric,

Thanks for your reply. But, my actual problem is the huge data, fetching that data and displaying such huge data is taking lot of time. So I was looking for some solution where on demand if I can access the required data and display in the report. Like first I can get all the parents and once I click on any of the parent it fetches the child records for that parent and display it on the same report. Please help on the same. If you've still some doubts then do let me know. Because I do need some kind of solution for this problem

Thanks & Regards,

SSRS

Deepak

|||What about using sub report ?|||

Subreports won't help much in this case, as they are processed at the same time as the main report.

You can try creating a master report that displays only aggreggate information per groups (the report query should use T-SQL group by, count and friends...)

Under each aggregate you can create a link (jump to report, aka drillthrough report) to a report containing the details for that particular group. And so on for all the grouping levels until you get to the details rows, which will hopefully be filtered out to a small enough number.

Hope that helps

Tudor Trufinescu

|||

I am having similar problem with huge data. I have linked a detailed report using jump to report. When the data is less it is running fine. But when my parameter selection retrieves huge data in the main report the problem is coming. It seems like it is executing the linked report along with the main report. It is not waiting till the cell is clicked to link. Why is it happening that way? The reason that I feel the linked report is also being executed along with the main report is, for the same parameter selection if I don't link the detailed report it is working fine. Any advice in this regard is much appreciated.

Thank you.

Displaying huge heirarchial data in reports

I need to display huge data around 1 million records in report. Data needs to be represented as heirarchial. So there is somewhere around 6 level of grouping of data. Can somebody suggest a solution to get the data and display the data in a faster way.

Thanks in advance.

SSRS

Hi,

I don't knw if I understand your problem but you could use the document map functionnality for every level of grouping you have.

HTH,

Eric

|||

Hi Eric,

Thanks for your reply. But, my actual problem is the huge data, fetching that data and displaying such huge data is taking lot of time. So I was looking for some solution where on demand if I can access the required data and display in the report. Like first I can get all the parents and once I click on any of the parent it fetches the child records for that parent and display it on the same report. Please help on the same. If you've still some doubts then do let me know. Because I do need some kind of solution for this problem

Thanks & Regards,

SSRS

Deepak

|||What about using sub report ?|||

Subreports won't help much in this case, as they are processed at the same time as the main report.

You can try creating a master report that displays only aggreggate information per groups (the report query should use T-SQL group by, count and friends...)

Under each aggregate you can create a link (jump to report, aka drillthrough report) to a report containing the details for that particular group. And so on for all the grouping levels until you get to the details rows, which will hopefully be filtered out to a small enough number.

Hope that helps

Tudor Trufinescu

|||

I am having similar problem with huge data. I have linked a detailed report using jump to report. When the data is less it is running fine. But when my parameter selection retrieves huge data in the main report the problem is coming. It seems like it is executing the linked report along with the main report. It is not waiting till the cell is clicked to link. Why is it happening that way? The reason that I feel the linked report is also being executed along with the main report is, for the same parameter selection if I don't link the detailed report it is working fine. Any advice in this regard is much appreciated.

Thank you.