flotsam: slower...

master
UbitUmarov 2020-07-28 21:01:45 +01:00
parent bd2476c61e
commit c575c211f9
2 changed files with 31 additions and 30 deletions

View File

@ -678,6 +678,13 @@ namespace OpenSim.Region.CoreModules.Asset
private void CleanupExpiredFiles(object source, ElapsedEventArgs e) private void CleanupExpiredFiles(object source, ElapsedEventArgs e)
{ {
lock (timerLock)
{
if(!m_timerRunning || m_cleanupRunning)
return;
m_cleanupRunning = true;
}
long heap = 0; long heap = 0;
//if (m_LogLevel >= 2) //if (m_LogLevel >= 2)
{ {
@ -685,19 +692,12 @@ namespace OpenSim.Region.CoreModules.Asset
heap = GC.GetTotalMemory(false); heap = GC.GetTotalMemory(false);
} }
lock (timerLock)
{
if(!m_timerRunning || m_cleanupRunning)
return;
m_cleanupRunning = true;
}
// Purge all files last accessed prior to this point // Purge all files last accessed prior to this point
DateTime purgeLine = DateTime.Now - m_FileExpiration; DateTime purgeLine = DateTime.Now - m_FileExpiration;
// An asset cache may contain local non-temporary assets that are not in the asset service. Therefore, // An asset cache may contain local non-temporary assets that are not in the asset service. Therefore,
// before cleaning up expired files we must scan the objects in the scene to make sure that we retain // before cleaning up expired files we must scan the objects in the scene to make sure that we retain
// such local assets if they have not been recently accessed. // such local assets if they have not been recently accessed.
m_log.Info("[FLOTSAM ASSET CACHE] start touch files of assets in use");
TouchAllSceneAssets(false); TouchAllSceneAssets(false);
int cooldown = 0; int cooldown = 0;
m_log.Info("[FLOTSAM ASSET CACHE] asset files expire"); m_log.Info("[FLOTSAM ASSET CACHE] asset files expire");
@ -742,7 +742,7 @@ namespace OpenSim.Region.CoreModules.Asset
if (File.GetLastAccessTime(file) < purgeLine) if (File.GetLastAccessTime(file) < purgeLine)
{ {
File.Delete(file); File.Delete(file);
cooldown += 5; cooldown += 2;
string id = Path.GetFileName(file); string id = Path.GetFileName(file);
if(!String.IsNullOrEmpty(id)) if(!String.IsNullOrEmpty(id))
{ {
@ -750,7 +750,7 @@ namespace OpenSim.Region.CoreModules.Asset
weakAssetReferences.Remove(id); weakAssetReferences.Remove(id);
} }
} }
if(++cooldown >= 100) if(++cooldown >= 30)
{ {
Thread.Sleep(50); Thread.Sleep(50);
cooldown = 0; cooldown = 0;
@ -952,6 +952,8 @@ namespace OpenSim.Region.CoreModules.Asset
/// <returns>Number of distinct asset references found in the scene.</returns> /// <returns>Number of distinct asset references found in the scene.</returns>
private int TouchAllSceneAssets(bool tryGetUncached) private int TouchAllSceneAssets(bool tryGetUncached)
{ {
m_log.Info("[FLOTSAM ASSET CACHE] start touch files of assets in use");
UuidGatherer gatherer = new UuidGatherer(m_AssetService); UuidGatherer gatherer = new UuidGatherer(m_AssetService);
int cooldown = 0; int cooldown = 0;
@ -980,7 +982,7 @@ namespace OpenSim.Region.CoreModules.Asset
gatherer.AddForInspection(e); gatherer.AddForInspection(e);
while(gatherer.GatherNext()) while(gatherer.GatherNext())
{ {
if (++cooldown > 100) if (++cooldown > 50)
{ {
Thread.Sleep(50); Thread.Sleep(50);
cooldown = 0; cooldown = 0;
@ -996,16 +998,15 @@ namespace OpenSim.Region.CoreModules.Asset
gatherer.GatherAll(); gatherer.GatherAll();
cooldown = 0; cooldown = 0;
// windows does not update access time :(
foreach(UUID id in gatherer.GatheredUuids.Keys) foreach(UUID id in gatherer.GatheredUuids.Keys)
{ {
string idstr = id.ToString(); string idstr = id.ToString();
if(!UpdateFileLastAccessTime(GetFileName(idstr)) && tryGetUncached) if(!UpdateFileLastAccessTime(GetFileName(idstr)) && tryGetUncached)
{ {
cooldown += 10; cooldown += 5;
m_AssetService.Get(idstr); m_AssetService.Get(idstr);
} }
if (++cooldown > 100) if (++cooldown > 50)
{ {
Thread.Sleep(50); Thread.Sleep(50);
cooldown = 0; cooldown = 0;

View File

@ -1802,7 +1802,7 @@
; AppDomainLoading = false ; AppDomainLoading = false
; Set this to true to load attachment scripts in separated domain, if AppDomainLoading is false ; Set this to true to load attachment scripts in separated domain, if AppDomainLoading is false
; same issues as AppDomainLoading, but my be usefull on regions with a lot of avatars traffic, if they carry scripts like AOs ; same issues as AppDomainLoading, but my be useful on regions with a lot of avatars traffic, if they carry scripts like AOs
; AttachmentsDomainLoading = false ; AttachmentsDomainLoading = false
; Controls whether previously compiled scripts DLLs are deleted on sim restart. ; Controls whether previously compiled scripts DLLs are deleted on sim restart.