I have an application that is using the Service Broker is SQL 2008. About once a day the database's performance starts take a noticeable hit and I have determined that this is because of the Service Broker. If I hard reset all broker connections using the following commands:
ALTERDATABASE [RegencyEnterprise] SETOFFLINEWITHROLLBACKIMMEDIATE
ALTERDATABASE [RegencyEnterprise] SETONLINE
Then the performance returns to normal until about the next day. I have also noticed that when performance is poor, running the following query returns a large number of conversations that are stuck in the STARTED_OUTBOUND state:
SELECT
conversation_handle,
is_initiator,
s.name as 'local service',
far_service,
sc.name 'contract',
state_desc
FROM
sys.conversation_endpoints ce
LEFT JOIN sys.services s ON ce.service_id = s.service_id
LEFT JOIN sys.service_contracts sc ON ce.service_contract_id = sc.service_contract_id;
Performance seems to be alright where there are plenty of items returned by this query. The only time when there are problems are when there are connections that are STARTED_OUTBOUND that stay stuck in this state.
Does anyone know what can cause the broker's connections to get in this state? Or what tools I could use to go about trying to figure out what is causing this? I currently only have a single web server that is registering to its notifications, so my scenario is not overly complex.