On 8/2/22 15:38, Dumitru Ceara wrote:
> On 8/2/22 15:23, Ilya Maximets wrote:
>> Transaction history is used only to construct row data updates for
>> clients, it's not used for checking data integrity, hence it doesn't
>> need a copy of weak references.
>>
>> Not copying this data saves a lot of CPU cycles and memory in some
>> cases.  For example, in 250-node density-heavy scenario in ovn-heater
>> these references can take up to 70% of RSS, which is about 8 GB of
>> essentially wasted memory as reported by valgrind massif:
>>
>>  
>> -------------------------------------------------------------------------------
>>    n        time(i)         total(B)    useful-heap(B) extra-heap(B)   
>> stacks(B)
>>  
>> -------------------------------------------------------------------------------
>>   20 1,011,495,832,314  11,610,557,104  10,217,785,620 1,392,771,484        0
>>
>>  88.00% (10,217,785,620B) (heap allocation functions) malloc/new/new[]
>>  ->70.47% (8,181,819,064B) 0x455372: xcalloc__ (util.c:121)
>>    ->70.07% (8,135,785,424B) 0x41609D: ovsdb_weak_ref_clone (row.c:66)
>>      ->70.07% (8,135,785,424B) 0x41609D: ovsdb_row_clone (row.c:151)
>>        ->34.74% (4,034,041,440B) 0x41B7C9: ovsdb_txn_clone 
>> (transaction.c:1124)
>>        | ->34.74% (4,034,041,440B) 0x41B7C9: ovsdb_txn_add_to_history 
>> (transaction.c:1163)
>>        |   ->34.74% (4,034,041,440B) 0x41B7C9: ovsdb_txn_replay_commit 
>> (transaction.c:1198)
>>        |     ->34.74% (4,034,041,440B) 0x408C35: parse_txn 
>> (ovsdb-server.c:633)
>>        |       ->34.74% (4,034,041,440B) 0x408C35: read_db 
>> (ovsdb-server.c:663)
>>        |         ->34.74% (4,034,041,440B) 0x406C9D: main_loop 
>> (ovsdb-server.c:238)
>>        |           ->34.74% (4,034,041,440B) 0x406C9D: main 
>> (ovsdb-server.c:500)
>>        |
>>        ->34.74% (4,034,041,440B) 0x41B7DE: ovsdb_txn_clone 
>> (transaction.c:1125)
>>          ->34.74% (4,034,041,440B) 0x41B7DE: ovsdb_txn_add_to_history 
>> (transaction.c:1163)
>>            ->34.74% (4,034,041,440B) 0x41B7DE: ovsdb_txn_replay_commit 
>> (transaction.c:1198)
>>              ->34.74% (4,034,041,440B) 0x408C35: parse_txn 
>> (ovsdb-server.c:633)
>>                ->34.74% (4,034,041,440B) 0x408C35: read_db 
>> (ovsdb-server.c:663)
>>                  ->34.74% (4,034,041,440B) 0x406C9D: main_loop 
>> (ovsdb-server.c:238)
>>                    ->34.74% (4,034,041,440B) 0x406C9D: main 
>> (ovsdb-server.c:500)
>>
>> Replacing ovsdb_row_clone() with ovsdb_row_datum_clone() to avoid
>> cloning unnecessary metadata.  The ovsdb_txn_clone() function re-named
>> to avoid issues if it will be re-used in the future for some other
>> use-case.
>>
>> Signed-off-by: Ilya Maximets <[email protected]>
>> ---
> 
> 
> This is great, looks good to me, thanks!
> 
> Acked-by: Dumitru Ceara <[email protected]>
> 

Applied.  Thanks!

Also backported to 3.0 as this seems to be an important simple fix and
all the prerequisites are already in place.

We could backport to 2.17 as well, but that will require some bits of
other patches, so I'm not sure.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to