* If a client session requests the same texture more than n times (currently n=5), we now drop the subsequent requests

* This may improve region memory usage
* This is a short-term response to a problem whereby some clients keep requesting the same texture even after we've sent it
* This treats the symptom rather than the cause.
* n can be adjusted by changing the constant at the top of UserTextureDownloadService if necessary
0.6.0-stable
Justin Clarke Casey 2008-03-21 19:16:29 +00:00
parent d76c6ee140
commit 45ea156804
3 changed files with 27 additions and 16 deletions

View File

@ -32,7 +32,14 @@ namespace OpenSim.Framework.Communications
public interface IGridServices public interface IGridServices
{ {
string gdebugRegionName { get; set; } string gdebugRegionName { get; set; }
/// <summary>
/// Register a region with the grid service.
/// </summary>
/// <param name="regionInfos"> </param>
/// <returns></returns>
RegionCommsListener RegisterRegion(RegionInfo regionInfos); RegionCommsListener RegisterRegion(RegionInfo regionInfos);
bool DeregisterRegion(RegionInfo regionInfo); bool DeregisterRegion(RegionInfo regionInfo);
List<SimpleRegionInfo> RequestNeighbours(uint x, uint y); List<SimpleRegionInfo> RequestNeighbours(uint x, uint y);
RegionInfo RequestNeighbourInfo(ulong regionHandle); RegionInfo RequestNeighbourInfo(ulong regionHandle);

View File

@ -89,11 +89,7 @@ namespace OpenSim.Region.Communications.OGS1
StartRemoting(); StartRemoting();
} }
/// <summary> // see IGridServices
///
/// </summary>
/// <param name="regionInfo"></param>
/// <returns></returns>
public RegionCommsListener RegisterRegion(RegionInfo regionInfo) public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
{ {
Hashtable GridParams = new Hashtable(); Hashtable GridParams = new Hashtable();

View File

@ -48,6 +48,11 @@ namespace OpenSim.Region.Environment.Modules
private static readonly log4net.ILog m_log private static readonly log4net.ILog m_log
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// We will allow the client to request the same texture n times before dropping further requests
/// </summary>
private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 5;
/// <summary> /// <summary>
/// Holds texture senders before they have received the appropriate texture from the asset cache. /// Holds texture senders before they have received the appropriate texture from the asset cache.
/// </summary> /// </summary>
@ -116,7 +121,7 @@ namespace OpenSim.Region.Environment.Modules
if (requests % 20 == 0) if (requests % 20 == 0)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[USER TEXTURE DOWNLOAD SERVICE]: Received {0} requests for the missing texture {1} from client {2}", "[USER TEXTURE DOWNLOAD SERVICE]: Received {0} requests for the already notified missing texture {1} from {2}",
requests, e.RequestedAssetID, m_client.AgentId); requests, e.RequestedAssetID, m_client.AgentId);
} }
@ -124,22 +129,25 @@ namespace OpenSim.Region.Environment.Modules
} }
else else
{ {
// Warn the log if we're getting requests for textures we've already dispatched // If we keep receiving requests for textures we've already served to the client,
// then stop sending them. This is a short term approach approach to the problem
// of clients which keep requesting the same texture - the long term approach
// will be to treat the cause (and possibly more generally cap the request
// queues as well/instead)
if (dispatchedTextureRequestCounts.ContainsKey(e.RequestedAssetID)) if (dispatchedTextureRequestCounts.ContainsKey(e.RequestedAssetID))
{ {
int requests = dispatchedTextureRequestCounts[e.RequestedAssetID] + 1; dispatchedTextureRequestCounts[e.RequestedAssetID] += 1;
if (requests % 20 == 0) if (dispatchedTextureRequestCounts[e.RequestedAssetID] > MAX_ALLOWED_TEXTURE_REQUESTS)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[USER TEXTURE DOWNLOAD SERVICE]: Received {0} requests for already dispatched texture {1} from client {2}", "[USER TEXTURE DOWNLOAD SERVICE]: No longer sending already dispatched texture {0} to {1} since it has made more than {2} requests for it",
requests, e.RequestedAssetID, m_client.AgentId); e.RequestedAssetID, m_client.AgentId, MAX_ALLOWED_TEXTURE_REQUESTS);
return;
}
} }
dispatchedTextureRequestCounts[e.RequestedAssetID] = requests;
}
//m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Adding download stat {0}", e.RequestedAssetID);
m_scene.AddPendingDownloads(1); m_scene.AddPendingDownloads(1);
TextureSender requestHandler = new TextureSender(m_client, e.DiscardLevel, e.PacketNumber); TextureSender requestHandler = new TextureSender(m_client, e.DiscardLevel, e.PacketNumber);