Giter Site home page Giter Site logo

Comments (4)

edechamps-Google avatar edechamps-Google commented on May 21, 2024

Thanks for the feedback.

Using the sample app, and the following command on an ADB root shell:

for fd in /proc/$(pidof com.google.samples.cronet.okhttptransport)/fd/*; do readlink "$fd"; done | sort

FD counts:

  • Sample app start: 84
  • After sending requests using pure OkHttp: 88
  • After initializing Cronet: 104
  • After sending requests using Cronet: 106

4 additional FDs when sending requests using pure OkHttp:

+/dev/ashmem
+pipe:[93397]
+pipe:[93397]
+socket:[93392]

20 additional FDs when initializing Cronet:

+/data/app/com.google.android.gms-44whme714CrlclOYAuJT3w==/base.apk
+/data/user_de/0/com.google.android.gms/app_chimera/m/00000001/CronetDynamite.apk
+/data/user_de/0/com.google.android.gms/app_chimera/m/00000001/CronetDynamite.apk
+/dev/ashmem
+/dev/urandom
+anon_inode:[eventfd]
+anon_inode:[eventfd]
+anon_inode:[eventpoll]
+anon_inode:[eventpoll]
+anon_inode:[eventpoll]
+anon_inode:[timerfd]
+anon_inode:[timerfd]
+pipe:[95093]
+pipe:[95093]
+pipe:[95353]
+pipe:[95353]
+socket:[95091]
+socket:[95092]
+socket:[95351]
+socket:[95352]

2 additional FDs when sending requests through Cronet:

+socket:[96661]
+socket:[98600]

So using Cronet results in 18 additional FDs being used, compared to pure OkHttp.

I also looked at the number of FDs being opened per contacted destination domain, but I couldn't find a clear regression between pure OkHttp and Cronet-backed OkHttp in that regard - they both seem to use 1 to 2 FD per destination domain.

To clarify, is it the 20 FDs fixed cost from Cronet initialization that's bothering you or are you observing behavior that isn't covered in the above?

from cronet-transport-for-okhttp.

marius-bardan avatar marius-bardan commented on May 21, 2024

I think it depends on the number of requests per app.
In case of an enterpise app with tens of requests being executed, we're hitting the process limit of opened FDs and OS kills the app.
We're not doing anything extra here - just using OkHttp vanilla vs using it with the Cronet interceptor (as basic as it can get).

from cronet-transport-for-okhttp.

Danstahrg avatar Danstahrg commented on May 21, 2024

I've tried issuing 1k concurrent OkHttp requests to the top 1k websites as indicated by this list: https://gist.github.com/bejaneps/ba8d8eed85b0c289a05c750b3d825f61. Like Etienne, I haven't experienced any issues with the setup and the number of open descriptors looks roughly consistent as the requests re being processed, with the exception of Cronet being a bit more aggressive with keeping them open towards the end. This was using the default Pixel 6 emulator with Android 13.

If you can reliably reproduce the issue in a sandbox setup repro steps would be much appreciated.

from cronet-transport-for-okhttp.

marius-bardan avatar marius-bardan commented on May 21, 2024

@Danstahrg can you please share the sample app code for that 1k requests test?

from cronet-transport-for-okhttp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.