Welcome Guest Search | Active Topics | Members | Log In | Register

WriteAsync delays sending data Options
Dan
Posted: Friday, April 30, 2010 2:27:21 PM
Rank: Member
Groups: Member

Joined: 4/23/2010
Posts: 4
Points: 12
I'm having this problem which I can not figure out. I have a server application that will have maybe like 5-10 clients connected to it. The application is recieving data and throwing it into a ring buffer. I have another thread that is processing the data and pushing it out to each client based on what they have subscribed to. Each client can recieve several hundred messages per second. The problem I seem to be running into is that when application starts sending (via WriteAsync) out messages at a higher rate of speed the messages start to buffer and delay and then the memory usage start to increase rapidly. Eventually the system will run out of physical memory and start using virtual memory which puts a huge load on the machine bringing it to it's knees. I have performance counters and statistics on all data elements moving through the application. Specfically, I have a counter for the number of sending packets & bytes via WriteAsync. I also have some counters via the XF.OperationCompleteDelagate for packets & bytes sent. As the higher rate of messages increase, the packets & bytes sent that are incremented via the XF.OperationCompleteDelagate stop increasing, while the sending packets & bytes continue to increase. If I suspend the dequeueing process which stop sending out new data via WriteAsync, Clients still continue to recieve delayed data even though the counters incremented via the XF.OperationCompleteDelagate still do not increase. I'm also using the XF.OperationFailureDelagate to log any errors, which is never called. It's almost as if the the data being sent via WriteAsync cannot keep up with the data rate and start to queue/delay causing a backlog. The application seems to have plenty of cpu (before the memory gets out of hand) and plenty of network bandwidth to work with, so I'm not sure what would be causing this. I was orginally using Socket.BeginSend and Socket.EndSend methods with the same result, which is why I rewrote to use the XF.Server components. Anyone have any ideas?

Thanks,

-Dan
admin
Posted: Tuesday, May 04, 2010 11:46:35 AM
Rank: Administration
Groups: Administration

Joined: 2/15/2008
Posts: 130
Points: 835
Dan,
Could you please send a demo prototype that can simulate the problem?
Dan
Posted: Thursday, May 06, 2010 12:21:50 PM
Rank: Member
Groups: Member

Joined: 4/23/2010
Posts: 4
Points: 12
I'm working on a prototype that can simulate what is happening. I've also been doing some additional analysis with performance monitor, etc. One thing I have discovered is most of the delay is in part because of some clients (Vista or Windows 7 machines). I'm not sure why it only affects Vista & Windows 7 (Maybe because the TCP/IP stack is different). I increased the buffer size on the client receive and that seem to fix the problem for the delay on Vista and Windows 7 machines (Didn't seem to make a difference on XP). Basically, what it seemed like was happening is that the server was trying to send the data, client buffers were full (Vista & Win7), so the data would be stored int he TCP/IP stack buffers on the server, causing the non-paged pool to increase rapidly. As we all know, this is a limited resource, so the machine would start to drop other socket connections. Now I'm trying to figure out how I can protect the server from doing this. I'd rather it stay stable and start to discard the data rather then having it buffer in the TCP/IP stack non-paged pool if a particular client is either on a slow connection or small buffer (which shouldn't be the case anymore).
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.6 (NET v2.0) - 11/14/2007
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.078 seconds.
10 queries (0.024 seconds, 30.77%).

yaf_pageload: 0.005
yaf_topic_info: 0.001
yaf_forum_list: 0.001
yaf_forum_listpath: 0.001
yaf_forum_listpath: 0.002
yaf_post_list: 0.008
yaf_usergroup_list: 0.001
yaf_usergroup_list: 0.001
yaf_usergroup_list: 0.002
yaf_active_listtopic: 0.002