diff options
author | UbitUmarov | 2016-07-16 19:53:41 +0100 |
---|---|---|
committer | UbitUmarov | 2016-07-16 19:53:41 +0100 |
commit | d1810866b3177c9c6026f619426c1bda72e14374 (patch) | |
tree | 1549ce924af875d296fcb67ef606e2c6a8e76228 /OpenSim/Region/ClientStack | |
parent | disable OSHttpTests that will collide with testing new http server changes (diff) | |
download | opensim-SC_OLD-d1810866b3177c9c6026f619426c1bda72e14374.zip opensim-SC_OLD-d1810866b3177c9c6026f619426c1bda72e14374.tar.gz opensim-SC_OLD-d1810866b3177c9c6026f619426c1bda72e14374.tar.bz2 opensim-SC_OLD-d1810866b3177c9c6026f619426c1bda72e14374.tar.xz |
simplify http textures and meshs Throttles
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 94 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 30 |
2 files changed, 24 insertions, 100 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 95d9c99..f66ef57 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -389,11 +389,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
389 | private volatile int currenttime = 0; | 389 | private volatile int currenttime = 0; |
390 | private volatile int lastTimeElapsed = 0; | 390 | private volatile int lastTimeElapsed = 0; |
391 | private volatile int BytesSent = 0; | 391 | private volatile int BytesSent = 0; |
392 | private int Lod3 = 0; | ||
393 | private int Lod2 = 0; | ||
394 | // private int Lod1 = 0; | ||
395 | private int UserSetThrottle = 0; | ||
396 | private int UDPSetThrottle = 0; | ||
397 | private int CapSetThrottle = 0; | 392 | private int CapSetThrottle = 0; |
398 | private float CapThrottleDistributon = 0.30f; | 393 | private float CapThrottleDistributon = 0.30f; |
399 | private readonly Scene m_scene; | 394 | private readonly Scene m_scene; |
@@ -403,6 +398,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
403 | public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene, UUID puser) | 398 | public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene, UUID puser) |
404 | { | 399 | { |
405 | ThrottleBytes = pBytes; | 400 | ThrottleBytes = pBytes; |
401 | if(ThrottleBytes < 10000) | ||
402 | ThrottleBytes = 10000; | ||
406 | lastTimeElapsed = Util.EnvironmentTickCount(); | 403 | lastTimeElapsed = Util.EnvironmentTickCount(); |
407 | Throttle = ThrottleOutPacketType.Asset; | 404 | Throttle = ThrottleOutPacketType.Asset; |
408 | m_scene = pScene; | 405 | m_scene = pScene; |
@@ -411,21 +408,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
411 | 408 | ||
412 | public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses) | 409 | public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses) |
413 | { | 410 | { |
414 | const float ThirtyPercent = 0.30f; | ||
415 | const float FivePercent = 0.05f; | ||
416 | PassTime(); | 411 | PassTime(); |
417 | // Note, this is called IN LOCK | 412 | // Note, this is called IN LOCK |
418 | bool haskey = responses.ContainsKey(key); | 413 | bool haskey = responses.ContainsKey(key); |
419 | 414 | ||
420 | if (responses.Count > 2) | ||
421 | { | ||
422 | SplitThrottle(ThirtyPercent); | ||
423 | } | ||
424 | else | ||
425 | { | ||
426 | SplitThrottle(FivePercent); | ||
427 | } | ||
428 | |||
429 | if (!haskey) | 415 | if (!haskey) |
430 | { | 416 | { |
431 | return false; | 417 | return false; |
@@ -433,29 +419,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
433 | aPollResponse response; | 419 | aPollResponse response; |
434 | if (responses.TryGetValue(key, out response)) | 420 | if (responses.TryGetValue(key, out response)) |
435 | { | 421 | { |
436 | float LOD3Over = (((ThrottleBytes*CapThrottleDistributon)%50000) + 1); | ||
437 | float LOD2Over = (((ThrottleBytes*CapThrottleDistributon)%10000) + 1); | ||
438 | // Normal | 422 | // Normal |
439 | if (BytesSent + response.bytes <= ThrottleBytes) | 423 | if (BytesSent <= ThrottleBytes) |
440 | { | ||
441 | BytesSent += response.bytes; | ||
442 | |||
443 | return true; | ||
444 | } | ||
445 | // Lod3 Over Throttle protection to keep things processing even when the throttle bandwidth is set too little. | ||
446 | else if (response.bytes > ThrottleBytes && Lod3 <= ((LOD3Over < 1)? 1: LOD3Over) ) | ||
447 | { | ||
448 | Interlocked.Increment(ref Lod3); | ||
449 | BytesSent += response.bytes; | ||
450 | |||
451 | return true; | ||
452 | } | ||
453 | // Lod2 Over Throttle protection to keep things processing even when the throttle bandwidth is set too little. | ||
454 | else if (response.bytes > ThrottleBytes && Lod2 <= ((LOD2Over < 1) ? 1 : LOD2Over)) | ||
455 | { | 424 | { |
456 | Interlocked.Increment(ref Lod2); | 425 | BytesSent += response.bytes; |
457 | BytesSent += response.bytes; | ||
458 | |||
459 | return true; | 426 | return true; |
460 | } | 427 | } |
461 | else | 428 | else |
@@ -463,27 +430,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
463 | return false; | 430 | return false; |
464 | } | 431 | } |
465 | } | 432 | } |
466 | |||
467 | return haskey; | 433 | return haskey; |
468 | } | 434 | } |
469 | public void SubtractBytes(int bytes,int lod) | ||
470 | { | ||
471 | BytesSent -= bytes; | ||
472 | } | ||
473 | private void SplitThrottle(float percentMultiplier) | ||
474 | { | ||
475 | |||
476 | if (CapThrottleDistributon != percentMultiplier) // don't switch it if it's already set at the % multipler | ||
477 | { | ||
478 | CapThrottleDistributon = percentMultiplier; | ||
479 | ScenePresence p; | ||
480 | if (m_scene.TryGetScenePresence(User, out p)) // If we don't get a user they're not here anymore. | ||
481 | { | ||
482 | // AlterThrottle(UserSetThrottle, p); | ||
483 | UpdateThrottle(UserSetThrottle, p); | ||
484 | } | ||
485 | } | ||
486 | } | ||
487 | 435 | ||
488 | public void ProcessTime() | 436 | public void ProcessTime() |
489 | { | 437 | { |
@@ -494,18 +442,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
494 | { | 442 | { |
495 | currenttime = Util.EnvironmentTickCount(); | 443 | currenttime = Util.EnvironmentTickCount(); |
496 | int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); | 444 | int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); |
497 | //processTimeBasedActions(responses); | 445 | if (timeElapsed >= 100) |
498 | if (currenttime - timeElapsed >= 1000) | ||
499 | { | 446 | { |
500 | lastTimeElapsed = Util.EnvironmentTickCount(); | 447 | lastTimeElapsed = currenttime; |
501 | BytesSent -= ThrottleBytes; | 448 | BytesSent -= (ThrottleBytes * timeElapsed / 1000); |
502 | if (BytesSent < 0) BytesSent = 0; | 449 | if (BytesSent < 0) BytesSent = 0; |
503 | if (BytesSent < ThrottleBytes) | ||
504 | { | ||
505 | Lod3 = 0; | ||
506 | Lod2 = 0; | ||
507 | // Lod1 = 0; | ||
508 | } | ||
509 | } | 450 | } |
510 | } | 451 | } |
511 | 452 | ||
@@ -517,25 +458,20 @@ namespace OpenSim.Region.ClientStack.Linden | |||
517 | public int ThrottleBytes | 458 | public int ThrottleBytes |
518 | { | 459 | { |
519 | get { return CapSetThrottle; } | 460 | get { return CapSetThrottle; } |
520 | set { CapSetThrottle = value; } | 461 | set |
462 | { | ||
463 | if (value > 10000) | ||
464 | CapSetThrottle = value; | ||
465 | else | ||
466 | CapSetThrottle = 10000; | ||
467 | } | ||
521 | } | 468 | } |
522 | 469 | ||
523 | internal void UpdateThrottle(int pimagethrottle, ScenePresence p) | 470 | internal void UpdateThrottle(int pimagethrottle, ScenePresence p) |
524 | { | 471 | { |
525 | // Client set throttle ! | 472 | // Client set throttle ! |
526 | UserSetThrottle = pimagethrottle; | 473 | CapSetThrottle = 2 * pimagethrottle; |
527 | CapSetThrottle = (int)(pimagethrottle*CapThrottleDistributon); | ||
528 | // UDPSetThrottle = (int) (pimagethrottle*(100 - CapThrottleDistributon)); | ||
529 | |||
530 | float udp = 1.0f - CapThrottleDistributon; | ||
531 | if(udp < 0.7f) | ||
532 | udp = 0.7f; | ||
533 | UDPSetThrottle = (int) ((float)pimagethrottle * udp); | ||
534 | if (CapSetThrottle < 4068) | ||
535 | CapSetThrottle = 4068; // at least two discovery mesh | ||
536 | p.ControllingClient.SetAgentThrottleSilent((int) Throttle, UDPSetThrottle); | ||
537 | ProcessTime(); | 474 | ProcessTime(); |
538 | |||
539 | } | 475 | } |
540 | } | 476 | } |
541 | } | 477 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 0c4e227..14a59fe 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -356,7 +356,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
356 | 356 | ||
357 | internal void UpdateThrottle(int pimagethrottle) | 357 | internal void UpdateThrottle(int pimagethrottle) |
358 | { | 358 | { |
359 | m_throttler.ThrottleBytes = pimagethrottle; | 359 | m_throttler.ThrottleBytes = 2 * pimagethrottle; |
360 | if(m_throttler.ThrottleBytes < 10000) | ||
361 | m_throttler.ThrottleBytes = 10000; | ||
360 | } | 362 | } |
361 | } | 363 | } |
362 | 364 | ||
@@ -425,10 +427,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
425 | private volatile int currenttime = 0; | 427 | private volatile int currenttime = 0; |
426 | private volatile int lastTimeElapsed = 0; | 428 | private volatile int lastTimeElapsed = 0; |
427 | private volatile int BytesSent = 0; | 429 | private volatile int BytesSent = 0; |
428 | private int oversizedImages = 0; | ||
429 | public CapsDataThrottler(int pBytes, int max, int min) | 430 | public CapsDataThrottler(int pBytes, int max, int min) |
430 | { | 431 | { |
431 | ThrottleBytes = pBytes; | 432 | ThrottleBytes = pBytes; |
433 | if(ThrottleBytes < 10000) | ||
434 | ThrottleBytes = 10000; | ||
432 | lastTimeElapsed = Util.EnvironmentTickCount(); | 435 | lastTimeElapsed = Util.EnvironmentTickCount(); |
433 | } | 436 | } |
434 | public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.aPollResponse> responses) | 437 | public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.aPollResponse> responses) |
@@ -448,20 +451,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
448 | return true; | 451 | return true; |
449 | 452 | ||
450 | // Normal | 453 | // Normal |
451 | if (BytesSent + response.bytes <= ThrottleBytes) | 454 | if (BytesSent <= ThrottleBytes) |
452 | { | 455 | { |
453 | BytesSent += response.bytes; | 456 | BytesSent += response.bytes; |
454 | //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + 1000, unlockyn = false }; | ||
455 | //m_actions.Add(timeBasedAction); | ||
456 | return true; | ||
457 | } | ||
458 | // Big textures | ||
459 | else if (response.bytes > ThrottleBytes && oversizedImages <= ((ThrottleBytes % 50000) + 1)) | ||
460 | { | ||
461 | Interlocked.Increment(ref oversizedImages); | ||
462 | BytesSent += response.bytes; | ||
463 | //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + (((response.bytes % ThrottleBytes)+1)*1000) , unlockyn = false }; | ||
464 | //m_actions.Add(timeBasedAction); | ||
465 | return true; | 457 | return true; |
466 | } | 458 | } |
467 | else | 459 | else |
@@ -483,15 +475,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
483 | currenttime = Util.EnvironmentTickCount(); | 475 | currenttime = Util.EnvironmentTickCount(); |
484 | int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); | 476 | int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); |
485 | //processTimeBasedActions(responses); | 477 | //processTimeBasedActions(responses); |
486 | if (Util.EnvironmentTickCountSubtract(currenttime, timeElapsed) >= 1000) | 478 | if (timeElapsed >= 100) |
487 | { | 479 | { |
488 | lastTimeElapsed = Util.EnvironmentTickCount(); | 480 | lastTimeElapsed = currenttime; |
489 | BytesSent -= ThrottleBytes; | 481 | BytesSent -= (ThrottleBytes * timeElapsed / 1000); |
490 | if (BytesSent < 0) BytesSent = 0; | 482 | if (BytesSent < 0) BytesSent = 0; |
491 | if (BytesSent < ThrottleBytes) | ||
492 | { | ||
493 | oversizedImages = 0; | ||
494 | } | ||
495 | } | 483 | } |
496 | } | 484 | } |
497 | public int ThrottleBytes; | 485 | public int ThrottleBytes; |