diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
10 files changed, 157 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 47dcbcd..6d1f0c2 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -57,13 +57,13 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
57 | /// <summary>List of client methods to notify of results of decode</summary> | 57 | /// <summary>List of client methods to notify of results of decode</summary> |
58 | private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>(); | 58 | private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>(); |
59 | /// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary> | 59 | /// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary> |
60 | private IImprovedAssetCache m_cache; | 60 | private IAssetCache m_cache; |
61 | private IImprovedAssetCache Cache | 61 | private IAssetCache Cache |
62 | { | 62 | { |
63 | get | 63 | get |
64 | { | 64 | { |
65 | if (m_cache == null) | 65 | if (m_cache == null) |
66 | m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); | 66 | m_cache = m_scene.RequestModuleInterface<IAssetCache>(); |
67 | 67 | ||
68 | return m_cache; | 68 | return m_cache; |
69 | } | 69 | } |
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index ebec9d2..14b0280 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs | |||
@@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
91 | /// </code> | 91 | /// </code> |
92 | /// </example> | 92 | /// </example> |
93 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CenomeMemoryAssetCache")] | 93 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CenomeMemoryAssetCache")] |
94 | public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule | 94 | public class CenomeMemoryAssetCache : IAssetCache, ISharedRegionModule |
95 | { | 95 | { |
96 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 96 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
97 | 97 | ||
@@ -192,7 +192,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
192 | expirationTime); | 192 | expirationTime); |
193 | } | 193 | } |
194 | 194 | ||
195 | #region IImprovedAssetCache Members | 195 | #region IAssetCache Members |
196 | 196 | ||
197 | public bool Check(string id) | 197 | public bool Check(string id) |
198 | { | 198 | { |
@@ -221,6 +221,11 @@ namespace OpenSim.Region.CoreModules.Asset | |||
221 | 221 | ||
222 | } | 222 | } |
223 | 223 | ||
224 | public void CacheNegative(string id) | ||
225 | { | ||
226 | // We don't do negative caching | ||
227 | } | ||
228 | |||
224 | /// <summary> | 229 | /// <summary> |
225 | /// Clear asset cache. | 230 | /// Clear asset cache. |
226 | /// </summary> | 231 | /// </summary> |
@@ -308,7 +313,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
308 | public void AddRegion(Scene scene) | 313 | public void AddRegion(Scene scene) |
309 | { | 314 | { |
310 | if (m_enabled) | 315 | if (m_enabled) |
311 | scene.RegisterModuleInterface<IImprovedAssetCache>(this); | 316 | scene.RegisterModuleInterface<IAssetCache>(this); |
312 | } | 317 | } |
313 | 318 | ||
314 | /// <summary> | 319 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs index f720748..82bc5cc 100644 --- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | |||
@@ -40,7 +40,7 @@ using OpenSim.Services.Interfaces; | |||
40 | namespace OpenSim.Region.CoreModules.Asset | 40 | namespace OpenSim.Region.CoreModules.Asset |
41 | { | 41 | { |
42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CoreAssetCache")] | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CoreAssetCache")] |
43 | public class CoreAssetCache : ISharedRegionModule, IImprovedAssetCache | 43 | public class CoreAssetCache : ISharedRegionModule, IAssetCache |
44 | { | 44 | { |
45 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
@@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
98 | public void AddRegion(Scene scene) | 98 | public void AddRegion(Scene scene) |
99 | { | 99 | { |
100 | if (m_Enabled) | 100 | if (m_Enabled) |
101 | scene.RegisterModuleInterface<IImprovedAssetCache>(this); | 101 | scene.RegisterModuleInterface<IAssetCache>(this); |
102 | } | 102 | } |
103 | 103 | ||
104 | public void RemoveRegion(Scene scene) | 104 | public void RemoveRegion(Scene scene) |
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
110 | } | 110 | } |
111 | 111 | ||
112 | //////////////////////////////////////////////////////////// | 112 | //////////////////////////////////////////////////////////// |
113 | // IImprovedAssetCache | 113 | // IAssetCache |
114 | // | 114 | // |
115 | public bool Check(string id) | 115 | public bool Check(string id) |
116 | { | 116 | { |
@@ -124,6 +124,11 @@ namespace OpenSim.Region.CoreModules.Asset | |||
124 | m_Cache.Store(asset.ID, asset); | 124 | m_Cache.Store(asset.ID, asset); |
125 | } | 125 | } |
126 | 126 | ||
127 | public void CacheNegative(string id) | ||
128 | { | ||
129 | // We don't do negative caching | ||
130 | } | ||
131 | |||
127 | public AssetBase Get(string id) | 132 | public AssetBase Get(string id) |
128 | { | 133 | { |
129 | return (AssetBase)m_Cache.Get(id); | 134 | return (AssetBase)m_Cache.Get(id); |
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index b6dd565..84e13a0 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -55,7 +55,7 @@ using OpenSim.Services.Interfaces; | |||
55 | namespace OpenSim.Region.CoreModules.Asset | 55 | namespace OpenSim.Region.CoreModules.Asset |
56 | { | 56 | { |
57 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FlotsamAssetCache")] | 57 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FlotsamAssetCache")] |
58 | public class FlotsamAssetCache : ISharedRegionModule, IImprovedAssetCache, IAssetService | 58 | public class FlotsamAssetCache : ISharedRegionModule, IAssetCache, IAssetService |
59 | { | 59 | { |
60 | private static readonly ILog m_log = | 60 | private static readonly ILog m_log = |
61 | LogManager.GetLogger( | 61 | LogManager.GetLogger( |
@@ -78,6 +78,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
78 | private static ulong m_RequestsForInprogress; | 78 | private static ulong m_RequestsForInprogress; |
79 | private static ulong m_DiskHits; | 79 | private static ulong m_DiskHits; |
80 | private static ulong m_MemoryHits; | 80 | private static ulong m_MemoryHits; |
81 | private static ulong m_weakRefHits; | ||
81 | 82 | ||
82 | #if WAIT_ON_INPROGRESS_REQUESTS | 83 | #if WAIT_ON_INPROGRESS_REQUESTS |
83 | private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>(); | 84 | private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>(); |
@@ -91,9 +92,15 @@ namespace OpenSim.Region.CoreModules.Asset | |||
91 | private ExpiringCache<string, AssetBase> m_MemoryCache; | 92 | private ExpiringCache<string, AssetBase> m_MemoryCache; |
92 | private bool m_MemoryCacheEnabled = false; | 93 | private bool m_MemoryCacheEnabled = false; |
93 | 94 | ||
95 | private ExpiringCache<string, object> m_negativeCache; | ||
96 | private bool m_negativeCacheEnabled = true; | ||
97 | private bool m_negativeCacheSliding = false; | ||
98 | |||
94 | // Expiration is expressed in hours. | 99 | // Expiration is expressed in hours. |
95 | private double m_MemoryExpiration = 0.001; | 100 | private double m_MemoryExpiration = 0.016; |
96 | private const double m_DefaultFileExpiration = 48; | 101 | private const double m_DefaultFileExpiration = 48; |
102 | // Negative cache is in seconds | ||
103 | private int m_negativeExpiration = 120; | ||
97 | private TimeSpan m_FileExpiration = TimeSpan.FromHours(m_DefaultFileExpiration); | 104 | private TimeSpan m_FileExpiration = TimeSpan.FromHours(m_DefaultFileExpiration); |
98 | private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.FromHours(1.0); | 105 | private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.FromHours(1.0); |
99 | 106 | ||
@@ -107,6 +114,10 @@ namespace OpenSim.Region.CoreModules.Asset | |||
107 | private List<Scene> m_Scenes = new List<Scene>(); | 114 | private List<Scene> m_Scenes = new List<Scene>(); |
108 | private object timerLock = new object(); | 115 | private object timerLock = new object(); |
109 | 116 | ||
117 | private Dictionary<string,WeakReference> weakAssetReferences = new Dictionary<string, WeakReference>(); | ||
118 | private object weakAssetReferencesLock = new object(); | ||
119 | private bool m_updateFileTimeOnCacheHit = false; | ||
120 | |||
110 | public FlotsamAssetCache() | 121 | public FlotsamAssetCache() |
111 | { | 122 | { |
112 | m_InvalidChars.AddRange(Path.GetInvalidPathChars()); | 123 | m_InvalidChars.AddRange(Path.GetInvalidPathChars()); |
@@ -134,6 +145,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
134 | if (name == Name) | 145 | if (name == Name) |
135 | { | 146 | { |
136 | m_MemoryCache = new ExpiringCache<string, AssetBase>(); | 147 | m_MemoryCache = new ExpiringCache<string, AssetBase>(); |
148 | m_negativeCache = new ExpiringCache<string, object>(); | ||
137 | m_Enabled = true; | 149 | m_Enabled = true; |
138 | 150 | ||
139 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} enabled", this.Name); | 151 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} enabled", this.Name); |
@@ -152,6 +164,11 @@ namespace OpenSim.Region.CoreModules.Asset | |||
152 | m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", m_MemoryCacheEnabled); | 164 | m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", m_MemoryCacheEnabled); |
153 | m_MemoryExpiration = assetConfig.GetDouble("MemoryCacheTimeout", m_MemoryExpiration); | 165 | m_MemoryExpiration = assetConfig.GetDouble("MemoryCacheTimeout", m_MemoryExpiration); |
154 | m_MemoryExpiration *= 3600.0; // config in hours to seconds | 166 | m_MemoryExpiration *= 3600.0; // config in hours to seconds |
167 | |||
168 | m_negativeCacheEnabled = assetConfig.GetBoolean("NegativeCacheEnabled", m_negativeCacheEnabled); | ||
169 | m_negativeExpiration = assetConfig.GetInt("NegativeCacheTimeout", m_negativeExpiration); | ||
170 | m_negativeCacheSliding = assetConfig.GetBoolean("NegativeCacheSliding", m_negativeCacheSliding); | ||
171 | m_updateFileTimeOnCacheHit = assetConfig.GetBoolean("UpdateFileTimeOnCacheHit", m_updateFileTimeOnCacheHit); | ||
155 | 172 | ||
156 | #if WAIT_ON_INPROGRESS_REQUESTS | 173 | #if WAIT_ON_INPROGRESS_REQUESTS |
157 | m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000); | 174 | m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000); |
@@ -212,7 +229,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
212 | { | 229 | { |
213 | if (m_Enabled) | 230 | if (m_Enabled) |
214 | { | 231 | { |
215 | scene.RegisterModuleInterface<IImprovedAssetCache>(this); | 232 | scene.RegisterModuleInterface<IAssetCache>(this); |
216 | m_Scenes.Add(scene); | 233 | m_Scenes.Add(scene); |
217 | } | 234 | } |
218 | } | 235 | } |
@@ -221,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
221 | { | 238 | { |
222 | if (m_Enabled) | 239 | if (m_Enabled) |
223 | { | 240 | { |
224 | scene.UnregisterModuleInterface<IImprovedAssetCache>(this); | 241 | scene.UnregisterModuleInterface<IAssetCache>(this); |
225 | m_Scenes.Remove(scene); | 242 | m_Scenes.Remove(scene); |
226 | lock(timerLock) | 243 | lock(timerLock) |
227 | { | 244 | { |
@@ -255,12 +272,23 @@ namespace OpenSim.Region.CoreModules.Asset | |||
255 | } | 272 | } |
256 | } | 273 | } |
257 | } | 274 | } |
275 | if (m_MemoryCacheEnabled) | ||
276 | m_MemoryCache = new ExpiringCache<string, AssetBase>(); | ||
277 | |||
278 | lock(weakAssetReferencesLock) | ||
279 | weakAssetReferences = new Dictionary<string, WeakReference>(); | ||
258 | } | 280 | } |
259 | } | 281 | } |
260 | 282 | ||
261 | //////////////////////////////////////////////////////////// | 283 | //////////////////////////////////////////////////////////// |
262 | // IImprovedAssetCache | 284 | // IAssetCache |
263 | // | 285 | // |
286 | private void UpdateWeakReference(string key, AssetBase asset) | ||
287 | { | ||
288 | WeakReference aref = new WeakReference(asset); | ||
289 | lock(weakAssetReferencesLock) | ||
290 | weakAssetReferences[key] = aref; | ||
291 | } | ||
264 | 292 | ||
265 | private void UpdateMemoryCache(string key, AssetBase asset) | 293 | private void UpdateMemoryCache(string key, AssetBase asset) |
266 | { | 294 | { |
@@ -327,6 +355,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
327 | if (asset != null) | 355 | if (asset != null) |
328 | { | 356 | { |
329 | //m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Caching asset with id {0}", asset.ID); | 357 | //m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Caching asset with id {0}", asset.ID); |
358 | UpdateWeakReference(asset.ID, asset); | ||
330 | 359 | ||
331 | if (m_MemoryCacheEnabled) | 360 | if (m_MemoryCacheEnabled) |
332 | UpdateMemoryCache(asset.ID, asset); | 361 | UpdateMemoryCache(asset.ID, asset); |
@@ -336,6 +365,17 @@ namespace OpenSim.Region.CoreModules.Asset | |||
336 | } | 365 | } |
337 | } | 366 | } |
338 | 367 | ||
368 | public void CacheNegative(string id) | ||
369 | { | ||
370 | if (m_negativeCacheEnabled) | ||
371 | { | ||
372 | if (m_negativeCacheSliding) | ||
373 | m_negativeCache.AddOrUpdate(id, null, TimeSpan.FromSeconds(m_negativeExpiration)); | ||
374 | else | ||
375 | m_negativeCache.AddOrUpdate(id, null, m_negativeExpiration); | ||
376 | } | ||
377 | } | ||
378 | |||
339 | /// <summary> | 379 | /// <summary> |
340 | /// Updates the cached file with the current time. | 380 | /// Updates the cached file with the current time. |
341 | /// </summary> | 381 | /// </summary> |
@@ -354,6 +394,25 @@ namespace OpenSim.Region.CoreModules.Asset | |||
354 | } | 394 | } |
355 | } | 395 | } |
356 | 396 | ||
397 | private AssetBase GetFromWeakReference(string id) | ||
398 | { | ||
399 | AssetBase asset = null; | ||
400 | WeakReference aref; | ||
401 | |||
402 | lock(weakAssetReferencesLock) | ||
403 | { | ||
404 | if (weakAssetReferences.TryGetValue(id, out aref)) | ||
405 | { | ||
406 | asset = aref.Target as AssetBase; | ||
407 | if(asset == null) | ||
408 | weakAssetReferences.Remove(id); | ||
409 | else | ||
410 | m_weakRefHits++; | ||
411 | } | ||
412 | } | ||
413 | return asset; | ||
414 | } | ||
415 | |||
357 | /// <summary> | 416 | /// <summary> |
358 | /// Try to get an asset from the in-memory cache. | 417 | /// Try to get an asset from the in-memory cache. |
359 | /// </summary> | 418 | /// </summary> |
@@ -476,13 +535,38 @@ namespace OpenSim.Region.CoreModules.Asset | |||
476 | { | 535 | { |
477 | m_Requests++; | 536 | m_Requests++; |
478 | 537 | ||
538 | object dummy; | ||
539 | if (m_negativeCache.TryGetValue(id, out dummy)) | ||
540 | return null; | ||
541 | |||
479 | AssetBase asset = null; | 542 | AssetBase asset = null; |
543 | asset = GetFromWeakReference(id); | ||
544 | if (asset != null && m_updateFileTimeOnCacheHit) | ||
545 | { | ||
546 | string filename = GetFileName(id); | ||
547 | UpdateFileLastAccessTime(filename); | ||
548 | } | ||
480 | 549 | ||
481 | if (m_MemoryCacheEnabled) | 550 | if (m_MemoryCacheEnabled && asset == null) |
551 | { | ||
482 | asset = GetFromMemoryCache(id); | 552 | asset = GetFromMemoryCache(id); |
553 | if(asset != null) | ||
554 | { | ||
555 | UpdateWeakReference(id,asset); | ||
556 | if (m_updateFileTimeOnCacheHit) | ||
557 | { | ||
558 | string filename = GetFileName(id); | ||
559 | UpdateFileLastAccessTime(filename); | ||
560 | } | ||
561 | } | ||
562 | } | ||
483 | 563 | ||
484 | if (asset == null && m_FileCacheEnabled) | 564 | if (asset == null && m_FileCacheEnabled) |
565 | { | ||
485 | asset = GetFromFileCache(id); | 566 | asset = GetFromFileCache(id); |
567 | if(asset != null) | ||
568 | UpdateWeakReference(id,asset); | ||
569 | } | ||
486 | 570 | ||
487 | if (m_MemoryCacheEnabled && asset != null) | 571 | if (m_MemoryCacheEnabled && asset != null) |
488 | UpdateMemoryCache(id, asset); | 572 | UpdateMemoryCache(id, asset); |
@@ -494,6 +578,12 @@ namespace OpenSim.Region.CoreModules.Asset | |||
494 | GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l)); | 578 | GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l)); |
495 | } | 579 | } |
496 | 580 | ||
581 | if(asset == null) | ||
582 | { | ||
583 | |||
584 | |||
585 | } | ||
586 | |||
497 | return asset; | 587 | return asset; |
498 | } | 588 | } |
499 | 589 | ||
@@ -530,6 +620,9 @@ namespace OpenSim.Region.CoreModules.Asset | |||
530 | 620 | ||
531 | if (m_MemoryCacheEnabled) | 621 | if (m_MemoryCacheEnabled) |
532 | m_MemoryCache.Remove(id); | 622 | m_MemoryCache.Remove(id); |
623 | |||
624 | lock(weakAssetReferencesLock) | ||
625 | weakAssetReferences.Remove(id); | ||
533 | } | 626 | } |
534 | catch (Exception e) | 627 | catch (Exception e) |
535 | { | 628 | { |
@@ -553,7 +646,12 @@ namespace OpenSim.Region.CoreModules.Asset | |||
553 | } | 646 | } |
554 | 647 | ||
555 | if (m_MemoryCacheEnabled) | 648 | if (m_MemoryCacheEnabled) |
556 | m_MemoryCache.Clear(); | 649 | m_MemoryCache = new ExpiringCache<string, AssetBase>(); |
650 | if (m_negativeCacheEnabled) | ||
651 | m_negativeCache = new ExpiringCache<string, object>(); | ||
652 | |||
653 | lock(weakAssetReferencesLock) | ||
654 | weakAssetReferences = new Dictionary<string, WeakReference>(); | ||
557 | } | 655 | } |
558 | 656 | ||
559 | private void CleanupExpiredFiles(object source, ElapsedEventArgs e) | 657 | private void CleanupExpiredFiles(object source, ElapsedEventArgs e) |
@@ -911,28 +1009,34 @@ namespace OpenSim.Region.CoreModules.Asset | |||
911 | List<string> outputLines = new List<string>(); | 1009 | List<string> outputLines = new List<string>(); |
912 | 1010 | ||
913 | double invReq = 100.0 / m_Requests; | 1011 | double invReq = 100.0 / m_Requests; |
1012 | |||
1013 | double weakHitRate = m_weakRefHits * invReq; | ||
1014 | int weakEntries = weakAssetReferences.Count; | ||
914 | 1015 | ||
915 | double fileHitRate = m_DiskHits * invReq; | 1016 | double fileHitRate = m_DiskHits * invReq; |
1017 | double TotalHitRate = weakHitRate + fileHitRate; | ||
1018 | |||
916 | outputLines.Add( | 1019 | outputLines.Add( |
917 | string.Format("File Hit Rate: {0}% for {1} requests", fileHitRate.ToString("0.00"), m_Requests)); | 1020 | string.Format("Total requests: {0}", m_Requests)); |
1021 | outputLines.Add( | ||
1022 | string.Format("unCollected Hit Rate: {0}% ({1} entries)", weakHitRate.ToString("0.00"),weakEntries)); | ||
1023 | outputLines.Add( | ||
1024 | string.Format("File Hit Rate: {0}%", fileHitRate.ToString("0.00"))); | ||
918 | 1025 | ||
919 | if (m_MemoryCacheEnabled) | 1026 | if (m_MemoryCacheEnabled) |
920 | { | 1027 | { |
921 | double HitRate = m_MemoryHits * invReq; | 1028 | double HitRate = m_MemoryHits * invReq; |
922 | |||
923 | outputLines.Add( | 1029 | outputLines.Add( |
924 | string.Format("Memory Hit Rate: {0}% for {1} requests", HitRate.ToString("0.00"), m_Requests)); | 1030 | string.Format("Memory Hit Rate: {0}%", HitRate.ToString("0.00"))); |
925 | 1031 | ||
926 | HitRate += fileHitRate; | 1032 | TotalHitRate += HitRate; |
927 | |||
928 | outputLines.Add( | ||
929 | string.Format("Total Hit Rate: {0}% for {1} requests", HitRate.ToString("0.00"), m_Requests)); | ||
930 | } | 1033 | } |
1034 | outputLines.Add( | ||
1035 | string.Format("Total Hit Rate: {0}%", TotalHitRate.ToString("0.00"))); | ||
931 | 1036 | ||
932 | outputLines.Add( | 1037 | outputLines.Add( |
933 | string.Format( | 1038 | string.Format( |
934 | "Unnecessary requests due to requests for assets that are currently downloading: {0}", | 1039 | "Requests overlap during file writing: {0}", m_RequestsForInprogress)); |
935 | m_RequestsForInprogress)); | ||
936 | 1040 | ||
937 | return outputLines; | 1041 | return outputLines; |
938 | } | 1042 | } |
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs index 5f76ac2..195bdaa 100644 --- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs | |||
@@ -41,7 +41,7 @@ using OpenSim.Services.Interfaces; | |||
41 | namespace OpenSim.Region.CoreModules.Asset | 41 | namespace OpenSim.Region.CoreModules.Asset |
42 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GlynnTuckerAssetCache")] | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GlynnTuckerAssetCache")] |
44 | public class GlynnTuckerAssetCache : ISharedRegionModule, IImprovedAssetCache | 44 | public class GlynnTuckerAssetCache : ISharedRegionModule, IAssetCache |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
100 | public void AddRegion(Scene scene) | 100 | public void AddRegion(Scene scene) |
101 | { | 101 | { |
102 | if (m_Enabled) | 102 | if (m_Enabled) |
103 | scene.RegisterModuleInterface<IImprovedAssetCache>(this); | 103 | scene.RegisterModuleInterface<IAssetCache>(this); |
104 | } | 104 | } |
105 | 105 | ||
106 | public void RemoveRegion(Scene scene) | 106 | public void RemoveRegion(Scene scene) |
@@ -112,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
112 | } | 112 | } |
113 | 113 | ||
114 | //////////////////////////////////////////////////////////// | 114 | //////////////////////////////////////////////////////////// |
115 | // IImprovedAssetCache | 115 | // IAssetCache |
116 | // | 116 | // |
117 | 117 | ||
118 | public bool Check(string id) | 118 | public bool Check(string id) |
@@ -126,6 +126,11 @@ namespace OpenSim.Region.CoreModules.Asset | |||
126 | m_Cache.AddOrUpdate(asset.ID, asset); | 126 | m_Cache.AddOrUpdate(asset.ID, asset); |
127 | } | 127 | } |
128 | 128 | ||
129 | public void CacheNegative(string id) | ||
130 | { | ||
131 | // We don't do negative caching | ||
132 | } | ||
133 | |||
129 | public AssetBase Get(string id) | 134 | public AssetBase Get(string id) |
130 | { | 135 | { |
131 | Object asset = null; | 136 | Object asset = null; |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 41a3f52..67256ee 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -288,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
288 | if (bakedTextures.Count == 0) | 288 | if (bakedTextures.Count == 0) |
289 | return false; | 289 | return false; |
290 | 290 | ||
291 | IImprovedAssetCache cache = sp.Scene.RequestModuleInterface<IImprovedAssetCache>(); | 291 | IAssetCache cache = sp.Scene.RequestModuleInterface<IAssetCache>(); |
292 | if(cache == null) | 292 | if(cache == null) |
293 | return true; // no baked local caching so nothing to do | 293 | return true; // no baked local caching so nothing to do |
294 | 294 | ||
@@ -705,7 +705,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
705 | return 0; | 705 | return 0; |
706 | 706 | ||
707 | int texturesRebaked = 0; | 707 | int texturesRebaked = 0; |
708 | // IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); | 708 | // IAssetCache cache = m_scene.RequestModuleInterface<IAssetCache>(); |
709 | 709 | ||
710 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) | 710 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) |
711 | { | 711 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 3f7a8ee..df5265c 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
69 | Dictionary<UUID, UUID> m_classifiedCache = new Dictionary<UUID, UUID>(); | 69 | Dictionary<UUID, UUID> m_classifiedCache = new Dictionary<UUID, UUID>(); |
70 | Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>(); | 70 | Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>(); |
71 | ExpiringCache<UUID, UserProfileCacheEntry> m_profilesCache = new ExpiringCache<UUID, UserProfileCacheEntry>(); | 71 | ExpiringCache<UUID, UserProfileCacheEntry> m_profilesCache = new ExpiringCache<UUID, UserProfileCacheEntry>(); |
72 | IImprovedAssetCache m_assetCache; | 72 | IAssetCache m_assetCache; |
73 | 73 | ||
74 | private JsonRpcRequestManager rpc = new JsonRpcRequestManager(); | 74 | private JsonRpcRequestManager rpc = new JsonRpcRequestManager(); |
75 | private bool m_allowUserProfileWebURLs = true; | 75 | private bool m_allowUserProfileWebURLs = true; |
@@ -221,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
221 | { | 221 | { |
222 | if(!Enabled) | 222 | if(!Enabled) |
223 | return; | 223 | return; |
224 | m_assetCache = Scene.RequestModuleInterface<IImprovedAssetCache>(); | 224 | m_assetCache = Scene.RequestModuleInterface<IAssetCache>(); |
225 | } | 225 | } |
226 | 226 | ||
227 | /// <summary> | 227 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index 9eb41f9..31d1129 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
48 | LogManager.GetLogger( | 48 | LogManager.GetLogger( |
49 | MethodBase.GetCurrentMethod().DeclaringType); | 49 | MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private IImprovedAssetCache m_Cache = null; | 51 | private IAssetCache m_Cache = null; |
52 | private IAssetService m_GridService; | 52 | private IAssetService m_GridService; |
53 | private IAssetService m_HGService; | 53 | private IAssetService m_HGService; |
54 | 54 | ||
@@ -176,7 +176,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
176 | 176 | ||
177 | if (m_Cache == null) | 177 | if (m_Cache == null) |
178 | { | 178 | { |
179 | m_Cache = scene.RequestModuleInterface<IImprovedAssetCache>(); | 179 | m_Cache = scene.RequestModuleInterface<IAssetCache>(); |
180 | 180 | ||
181 | if (!(m_Cache is ISharedRegionModule)) | 181 | if (!(m_Cache is ISharedRegionModule)) |
182 | m_Cache = null; | 182 | m_Cache = null; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 5f34450..d5d6667 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | private IImprovedAssetCache m_Cache = null; | 47 | private IAssetCache m_Cache = null; |
48 | 48 | ||
49 | private IAssetService m_AssetService; | 49 | private IAssetService m_AssetService; |
50 | 50 | ||
@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
128 | 128 | ||
129 | if (m_Cache == null) | 129 | if (m_Cache == null) |
130 | { | 130 | { |
131 | m_Cache = scene.RequestModuleInterface<IImprovedAssetCache>(); | 131 | m_Cache = scene.RequestModuleInterface<IAssetCache>(); |
132 | 132 | ||
133 | if (!(m_Cache is ISharedRegionModule)) | 133 | if (!(m_Cache is ISharedRegionModule)) |
134 | m_Cache = null; | 134 | m_Cache = null; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs index e6eeacf..ff04f9d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs | |||
@@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
48 | MethodBase.GetCurrentMethod().DeclaringType); | 48 | MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | private bool m_Enabled = false; | 50 | private bool m_Enabled = false; |
51 | private IImprovedAssetCache m_Cache; | 51 | private IAssetCache m_Cache; |
52 | 52 | ||
53 | public Type ReplaceableInterface | 53 | public Type ReplaceableInterface |
54 | { | 54 | { |
@@ -111,7 +111,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
111 | 111 | ||
112 | if (m_Cache == null) | 112 | if (m_Cache == null) |
113 | { | 113 | { |
114 | m_Cache = scene.RequestModuleInterface<IImprovedAssetCache>(); | 114 | m_Cache = scene.RequestModuleInterface<IAssetCache>(); |
115 | 115 | ||
116 | // Since we are a shared module and scene data is not | 116 | // Since we are a shared module and scene data is not |
117 | // available for every method, the cache must be shared, too | 117 | // available for every method, the cache must be shared, too |