matrice-streaming 0.1.71__py3-none-any.whl → 0.1.72__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -101,7 +101,7 @@ class AsyncCameraWorker:
101
101
  # ================================================================
102
102
  drop_stale_frames: bool = False, # Disabled for ML quality
103
103
  use_simple_read: bool = True, # Use cap.read() directly instead of grab/retrieve
104
- pin_cpu_affinity: bool = True, # Pin worker to specific CPU cores
104
+ pin_cpu_affinity: bool = False, # Let OS distribute threads (avoids cache contention)
105
105
  total_workers: int = 1, # Total worker count for CPU affinity calculation
106
106
  buffer_size: int = 1, # Minimal buffer for low latency (cv2_bench uses 1)
107
107
  ):
@@ -240,8 +240,8 @@ class AsyncCameraWorker:
240
240
  # - But TOO many threads causes burst frame arrivals → Redis write queue backup
241
241
  # - Cap at 64 threads to balance I/O parallelism vs write contention
242
242
  num_cameras = len(camera_configs)
243
- # Use 1 thread per camera, capped at 64 to prevent write burst contention
244
- num_capture_threads = min(64, max(8, num_cameras))
243
+ # Use 1 thread per camera, max 64 for reduced contention
244
+ num_capture_threads = min(64, num_cameras)
245
245
  self.capture_executor = ThreadPoolExecutor(max_workers=num_capture_threads)
246
246
  self.num_capture_threads = num_capture_threads
247
247
 
@@ -1335,7 +1335,7 @@ def run_async_worker(
1335
1335
  # ================================================================
1336
1336
  drop_stale_frames: bool = False, # Disabled for ML quality
1337
1337
  use_simple_read: bool = True, # Use cap.read() directly instead of grab/retrieve
1338
- pin_cpu_affinity: bool = True,
1338
+ pin_cpu_affinity: bool = False, # Let OS distribute (avoids cache contention)
1339
1339
  total_workers: int = 1,
1340
1340
  buffer_size: int = 1,
1341
1341
  # ================================================================
@@ -45,7 +45,7 @@ class WorkerManager:
45
45
  # ================================================================
46
46
  drop_stale_frames: bool = False, # Use grab()/grab()/retrieve() for latest frame (disabled for ML quality)
47
47
  use_simple_read: bool = True, # Use cap.read() directly instead of grab/retrieve
48
- pin_cpu_affinity: bool = True, # Pin workers to specific CPU cores
48
+ pin_cpu_affinity: bool = False, # Let OS distribute (avoids cache contention)
49
49
  buffer_size: int = 1, # VideoCapture buffer size (1 = minimal latency)
50
50
  # ================================================================
51
51
  # FRAME OPTIMIZER: Control frame similarity detection
@@ -78,17 +78,18 @@ class WorkerManager:
78
78
  cpu_count = os.cpu_count() or 4 # Fallback to 4 if can't detect
79
79
  num_cameras = len(camera_configs)
80
80
 
81
- # For systems with 16+ cores OR large camera counts, use camera-based calculation
82
- # This applies to Docker containers with limited CPU allocation (e.g., 20 cores)
83
- # Too many workers = process overhead; too few = underutilization
84
- # Target: ~25 cameras per worker for better read parallelism with video files
85
- if cpu_count >= 16 or num_cameras >= 100:
81
+ # Small deployments: 1 worker per camera for maximum parallelism
82
+ # Each worker process has its own GIL, enabling true CPU parallelism
83
+ if num_cameras <= 10:
84
+ calculated_workers = max(1, num_cameras)
85
+ # Large deployments: use camera-based calculation
86
+ elif cpu_count >= 16 or num_cameras >= 100:
86
87
  # Use camera-based calculation for better distribution
87
88
  # 1000 cameras / 25 cameras per worker = 40 workers
88
89
  target_cameras_per_worker = 25
89
90
  calculated_workers = max(4, min(num_cameras // target_cameras_per_worker, 50))
90
91
  else:
91
- # Standard calculation for smaller systems
92
+ # Standard calculation for medium systems
92
93
  calculated_workers = max(4, int(cpu_count * cpu_percentage))
93
94
 
94
95
  # Cap at camera count (no point having more workers than cameras)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_streaming
3
- Version: 0.1.71
3
+ Version: 0.1.72
4
4
  Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
@@ -19,7 +19,7 @@ matrice_streaming/streaming_gateway/streaming_gateway_utils.py,sha256=6kNYgl3f7H
19
19
  matrice_streaming/streaming_gateway/streaming_status_listener.py,sha256=RgbW0xYbbpmO6ZjkVlh6fg8iqkpRaIShR2dQ3SMVFUw,3161
20
20
  matrice_streaming/streaming_gateway/camera_streamer/ARCHITECTURE.md,sha256=kngsqiS1PdNYhihBoMtoiIf3THJ4OM33E_hxExqzKqY,9980
21
21
  matrice_streaming/streaming_gateway/camera_streamer/__init__.py,sha256=nwVY-ySnKvOedeDXakyR_6KPHSz3yzSeaO_4IFMMP4I,2219
22
- matrice_streaming/streaming_gateway/camera_streamer/async_camera_worker.py,sha256=j1ZJYwE4Ohh0DdCGlGWA2c-baMHHZ-e4yX3g1bx-Zig,61199
22
+ matrice_streaming/streaming_gateway/camera_streamer/async_camera_worker.py,sha256=W6hEeh0KLGXIBAixDIomAAOOoo5QectCp1__RHLS-ko,61242
23
23
  matrice_streaming/streaming_gateway/camera_streamer/async_ffmpeg_worker.py,sha256=cD3XocWqamkBE9TlkG757OK6tl_Op45r-cMd-ZgJXaA,37063
24
24
  matrice_streaming/streaming_gateway/camera_streamer/camera_streamer.py,sha256=zv6tWUKQf2uXAxqtSlfwAVDb9N483VCRApPogUWJ9e8,39113
25
25
  matrice_streaming/streaming_gateway/camera_streamer/device_detection.py,sha256=9F4rsbMpIexOIlX8aCj7Q6PFG01kOS1wtgAIQBG0FaM,18463
@@ -39,7 +39,7 @@ matrice_streaming/streaming_gateway/camera_streamer/platform_pipelines.py,sha256
39
39
  matrice_streaming/streaming_gateway/camera_streamer/retry_manager.py,sha256=d8tlGoWoeSlgpCgXbUHTM61ekCQZki7TO1HzL2yPVzk,3607
40
40
  matrice_streaming/streaming_gateway/camera_streamer/stream_statistics.py,sha256=VC1S6ogiHUTlzTqn2wGOC1ClOEjvDgWm9Ydi9sWj-Do,18951
41
41
  matrice_streaming/streaming_gateway/camera_streamer/video_capture_manager.py,sha256=ySnbihdkpFPcBdFK_OFcHE-MgjG2YirUUYgEJHhvTxo,16899
42
- matrice_streaming/streaming_gateway/camera_streamer/worker_manager.py,sha256=y8Ew3TnNHkTMcaAPDy3OsVqx0w2QShpC7cyomvhRyZ8,29355
42
+ matrice_streaming/streaming_gateway/camera_streamer/worker_manager.py,sha256=Vfdz9DaLkkTlRqg2_DKk4pkUmxQbEaI44c82X7ro8OU,29322
43
43
  matrice_streaming/streaming_gateway/debug/README.md,sha256=6GeHClMjJbmVuSKbJ8yOIDqpeAPnLNrHXMFtmubZz0E,11343
44
44
  matrice_streaming/streaming_gateway/debug/__init__.py,sha256=_RtvH0Y12HFiDoKK8BEsMwy6k_iAFjmYYNzMawbOfeQ,2026
45
45
  matrice_streaming/streaming_gateway/debug/benchmark.py,sha256=65la9K2mjiiuADCBSnYpPr9uYFnM89clgw-KHkjSkAU,25563
@@ -49,8 +49,8 @@ matrice_streaming/streaming_gateway/debug/debug_streaming_gateway.py,sha256=ZiDg
49
49
  matrice_streaming/streaming_gateway/debug/debug_utils.py,sha256=jWcSBgrk_YVt1QzSyw6geX17YBnTvgVdA5ubqO531a0,10477
50
50
  matrice_streaming/streaming_gateway/debug/example_debug_streaming.py,sha256=-gS8zNDswAoj6oss66QQWYZhY24usfLiMH0FFK06vV0,7994
51
51
  matrice_streaming/streaming_gateway/debug/test_videoplayback.py,sha256=s_dgWkoESiuJHlUAf_iv4d7OGmAhwocwDZmIcFUZzvo,11093
52
- matrice_streaming-0.1.71.dist-info/licenses/LICENSE.txt,sha256=_uQUZpgO0mRYL5-fPoEvLSbNnLPv6OmbeEDCHXhK6Qc,1066
53
- matrice_streaming-0.1.71.dist-info/METADATA,sha256=rKRMjhTa3a-56AdVkQlK8c925MRGwBU4qw1auHmDAaU,2477
54
- matrice_streaming-0.1.71.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
- matrice_streaming-0.1.71.dist-info/top_level.txt,sha256=PM_trIe8f4JLc90J871rNMYGVM3Po9Inx4As5LrCFUU,18
56
- matrice_streaming-0.1.71.dist-info/RECORD,,
52
+ matrice_streaming-0.1.72.dist-info/licenses/LICENSE.txt,sha256=_uQUZpgO0mRYL5-fPoEvLSbNnLPv6OmbeEDCHXhK6Qc,1066
53
+ matrice_streaming-0.1.72.dist-info/METADATA,sha256=R5X_pdLFu9o3SUw0LXwB0xsbxvk0b3We7IbCpoRwgQc,2477
54
+ matrice_streaming-0.1.72.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
+ matrice_streaming-0.1.72.dist-info/top_level.txt,sha256=PM_trIe8f4JLc90J871rNMYGVM3Po9Inx4As5LrCFUU,18
56
+ matrice_streaming-0.1.72.dist-info/RECORD,,