Hey Kyle,

gRPC C++ doesn't have many knobs to reduce the footprint. One option you 
can try is "--define=grpc_no_xds=true" for bazel. Unfortunately, this 
option isn't available for cmake but you can take a look at what can be 
removed by this option since you've made local changes already.

Regards,
Esun.

On Thursday, May 4, 2023 at 8:22:52 AM UTC-7 Kyle Loveless wrote:

> In case it's useful to others, I dropped the size in my compiled binary 
> from 2.4Mi to 2Mi by:
>
>    - Not including //src/core:grpc_external_account_credentials (with 
>    minor function changes not to try it)
>    - Not including any of the load balancers I was not using (PickFirst 
>    is the default)
>    - Removing the grpc_resolver_dns_ares (with a small number of code 
>    changes)
>    - Also RegisterFakeResolver, RegisterHttpProxyMapper, 
>    FaultInjectionFilterRegister
>
> This was done just with an unconditional local patch for now.
>
> On Saturday, April 29, 2023 at 12:56:36 AM UTC-4 Kyle Loveless wrote:
>
>> Hey folks,
>>
>> Just curious if there is a current opinion about opportunities to make 
>> gRPC a smaller final library - with or without symbols.
>>
>> Using bloaty <https://github.com/google/bloaty/blob/main/doc/using.md>, 
>> my C++ server, which uses gRPC, has ~2.4MiB of VM size from it (not 
>> including other dependencies, like proto or SSL), and 59.4MB of file size 
>> (the difference being debug symbols, if not stripped). While ~2.4MiB 
>> doesn't seem too bad, the debug symbols are bit hefty.
>>
>> I poked around a bit, and I suspect there is some opportunity for 
>> additional compile options so more can be dropped at link time. For 
>> instance:
>>
>>    - Several types of credentials, even though maybe only a small subset 
>>    are used. e.g. 
>>    
>> src/core/lib/security/credentials/external/aws_external_account_credentials.cc
>>  
>>    uses 32KiB of VM, and 476Ki with symbols. Presumably this only applies 
>> for 
>>    certain users, and not in my case, but is kept during linking since it is 
>>    not known it won't come up.
>>    - All of the load balancing policies are linked in, even though maybe 
>>    only a small subset are used. rls/ is 95Ki of VM, 2.7MiB with symbols), 
>>    outlier detection is 30 KiB of VM, 914KiB with symbols.
>>
>> And of course, everything is a trade-off - more options means more 
>> variations for users and possible confusion.
>>
>> Thoughts? Are there possible options that folks that could opt-in that 
>> could lead to significant reductions to make it worth it?
>>
>> Thanks!
>>
>> Kyle
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/f2bd9437-551a-4a92-9a9e-0ed3451a19d6n%40googlegroups.com.

Reply via email to