@@ -216,8 +216,8 @@ def verify_vpp_memory(config: dict):
216
216
main_heap_size = mem_checks .memory_main_heap (config ['settings' ])
217
217
main_heap_page_size = mem_checks .main_heap_page_size (config ['settings' ])
218
218
219
- if main_heap_size < 51 << 20 :
220
- raise ConfigError ('The main heap size must be greater than or equal to 51M ' )
219
+ if main_heap_size < 1 << 30 :
220
+ raise ConfigError ('The main heap size must be greater than or equal to 1G ' )
221
221
222
222
readable_heap_page = bytes_to_human_memory (main_heap_page_size , 'K' )
223
223
@@ -368,8 +368,8 @@ def verify_vpp_statseg_size(settings: dict):
368
368
statseg_size = mem_checks .statseg_size (settings )
369
369
370
370
if 'size' in settings .get ('statseg' ):
371
- if statseg_size < 1 << 20 :
372
- raise ConfigError ('The statseg size must be greater than or equal to 1M ' )
371
+ if statseg_size < 128 << 20 :
372
+ raise ConfigError ('The statseg size must be greater than or equal to 128M ' )
373
373
374
374
if 'page_size' in settings ['statseg' ]:
375
375
statseg_page_size = mem_checks .statseg_page_size (settings )
@@ -405,3 +405,29 @@ def verify_vpp_host_resources(config: dict):
405
405
'or VPP could work not properly. Please set up '
406
406
f'"vpp settings host-resources max-map-count" to { 2 * hugepages } or higher'
407
407
)
408
+
409
+
410
+ def verify_routes_count (settings : dict , workers : int ):
411
+ """
412
+ Maximum routes count depending on main heap size,
413
+ statistics segment size and workers
414
+ """
415
+ counters = 2 # 2 counters for each route
416
+ bytes = 16 # each counter consumes 16 bytes
417
+ statseg_scale = 2
418
+ statseg_size = settings ['statseg' ]['size' ]
419
+ statseg_size_in_bytes = human_memory_to_bytes (statseg_size )
420
+ main_heap = settings ['memory' ]['main_heap_size' ]
421
+ main_heap_in_gb = human_memory_to_bytes (main_heap ) >> 30
422
+
423
+ formula = (workers + 1 ) * counters * bytes * statseg_scale
424
+ routes_count_statseg = statseg_size_in_bytes / formula
425
+ routes_count_statseg = round (routes_count_statseg / 1_000_000 , 2 )
426
+ routes_count_mh = main_heap_in_gb * 2
427
+ routes_count_min = min (routes_count_statseg , routes_count_mh )
428
+ Warning (
429
+ f'NOTE: Current dataplane capacity (estimated): { routes_count_min } M IPv4 routes. '
430
+ 'Exceeding these values will lead to a dataplane out-of-memory condition and a crash. '
431
+ 'Extensive use of features like ACLs, NAT and others may reduce the numbers above. '
432
+ 'Please read the documentation for details: https://docs.vyos.io/'
433
+ )
0 commit comments