Cronet for iOS

1,763 views
Skip to first unread message

Rajesh Mahindra

unread,
Mar 26, 2018, 1:49:55 PM3/26/18
to net-dev
Hi

I see that there are a few documents and a sample app for Cronet integration in an Android app. Is there a sample app for iOS? Also, is there a link to the pre-built libs for iOS. Any help would be appreciated.

Thanks
Rajesh

Cherie Shi

unread,
Mar 26, 2018, 2:04:31 PM3/26/18
to Rajesh Mahindra, net-dev, kapis...@chromium.org, Misha Efimov
I believe we do have sample iOS apps using Cronet. Cronet build(for iOS) instructions are available here

Misha or Andrei from cronet team should be able to provide more details.


Rajesh

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.
To post to this group, send email to net...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/2f941eba-ea8c-48bf-889b-11b183c6f0a9%40chromium.org.

Misha Efimov

unread,
Mar 26, 2018, 3:05:04 PM3/26/18
to Rajesh Mahindra, net-dev
On Mon, Mar 26, 2018 at 1:49 PM, 'Rajesh Mahindra' via net-dev <net...@chromium.org> wrote:
Hi

I see that there are a few documents and a sample app for Cronet integration in an Android app. Is there a sample app for iOS?

Yes, cronet_consumer is the sample app that uses Cronet on iOS. 
 
Also, is there a link to the pre-built libs for iOS. Any help would be appreciated.

Pre-built libraries are stored here: https://console.cloud.google.com/storage/browser/chromium-cronet/ios/<release_version>/ 

Rajesh Mahindra

unread,
Mar 26, 2018, 5:53:38 PM3/26/18
to Misha Efimov, net-dev
@Cherie, @Misha, Thanks, this is super helpful

Rajesh

On Mon, Mar 26, 2018 at 12:05 PM Misha Efimov <m...@chromium.org> wrote:
On Mon, Mar 26, 2018 at 1:49 PM, 'Rajesh Mahindra' via net-dev <net...@chromium.org> wrote:
Hi

I see that there are a few documents and a sample app for Cronet integration in an Android app. Is there a sample app for iOS?

Yes, cronet_consumer is the sample app that uses Cronet on iOS. 
 
Also, is there a link to the pre-built libs for iOS. Any help would be appreciated.

Pre-built libraries are stored here: https://console.cloud.google.com/storage/browser/chromium-cronet/ios/<release_version>/ 

Thanks
Rajesh

--

You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+u...@chromium.org.

Rajesh Mahindra

unread,
Mar 28, 2018, 1:51:31 PM3/28/18
to Rajesh Mahindra, Misha Efimov, net-dev
Actually, the above worked after removing --nohooks.

However, is there a way i can open the sample Cronet app in xcode after building? I want to test a few other scenarios that may require code changes?

Rajesh

On Wed, Mar 28, 2018 at 9:34 AM Rajesh Mahindra <rmah...@gmail.com> wrote:
I tried building chromium in Mac to build ios package. While the builds for android worked on linux, I get the following error on mac:

$ fetch --no-history --nohooks ios

$ gclient sync

/Users/rajeshmahindra/depot_tools/cipd: line 103: /Users/rajeshmahindra/depot_tools/.cipd_client: cannot execute binary file

selfupdate failed: run `CIPD_HTTP_USER_AGENT_PREFIX=depot_tools/96fc33383b6d11e2c21cad26d131873ea67fb1ad/manual /Users/rajeshmahindra/depot_tools/.cipd_client selfupdate -version 'git_revision:4d19637ec2c3d1efd8c6a1b05285118b786919e2'` to diagnose


/Users/rajeshmahindra/depot_tools/cipd: line 109: /Users/rajeshmahindra/depot_tools/.cipd_client: cannot execute binary file

/Users/rajeshmahindra/depot_tools/cipd: line 109: /Users/rajeshmahindra/depot_tools/.cipd_client: Undefined error: 0

/Users/rajeshmahindra/chromium/.gclient_entries missing, .gclient file in parent directory /Users/rajeshmahindra/chromium might not be the file you want to use.

Syncing projects: 100% (90/90), done.                                                        


________ running 'cipd ensure -log-level error -root /Users/rajeshmahindra/chromium -ensure-file /var/folders/fn/6vyxv6qd0ng0s0_r8ffx5b1c0000gn/T/tmpcnaWo6.ensure' in '.'

/Users/rajeshmahindra/depot_tools/cipd: line 103: /Users/rajeshmahindra/depot_tools/.cipd_client: cannot execute binary file

selfupdate failed: run `CIPD_HTTP_USER_AGENT_PREFIX=depot_tools/96fc33383b6d11e2c21cad26d131873ea67fb1ad/manual /Users/rajeshmahindra/depot_tools/.cipd_client selfupdate -version 'git_revision:4d19637ec2c3d1efd8c6a1b05285118b786919e2'` to diagnose



Thanks

Rajesh

Misha Efimov

unread,
Mar 28, 2018, 3:09:37 PM3/28/18
to Rajesh Mahindra, Rajesh Mahindra, net-dev
Yes, if you run 

 

`components/cronet/tools/cr_cronet.py gn`


then you should be able to `open out/out/Debug-iphonesimulator/all.xcworkspace`, generate schemes and select "cronet_consumer" project.



To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.

To post to this group, send email to net...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.

To post to this group, send email to net...@chromium.org.

Rajesh Mahindra

unread,
Mar 28, 2018, 6:37:10 PM3/28/18
to Misha Efimov, Rajesh Mahindra, net-dev
Great, thanks it works for me. However, i see that the following line is missing in the cronet_consumer/cronet_consumer_app_delegate.mm that prevents the app from using Cronet completely:

[Cronet registerHttpProtocolHandler];


Thanks,

Rajesh


To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+u...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+u...@chromium.org.

To post to this group, send email to net...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+u...@chromium.org.

To post to this group, send email to net...@chromium.org.

Rajesh Mahindra

unread,
Apr 23, 2018, 8:32:14 PM4/23/18
to Misha Efimov, Rajesh Mahindra, net-dev
Hi Misha,

I tried compiling Cronet (Static Cronet.framework) with my own sample app. However, it fails with following errors:

Undefined symbols for architecture arm64:

  "_res_9_ninit", referenced from:

      net::internal::DnsConfigServicePosix::ConfigReader::DoWork() in libCronet.a(cronet_static_complete.o)

  "_res_9_ndestroy", referenced from:

      net::internal::DnsConfigServicePosix::ConfigReader::DoWork() in libCronet.a(cronet_static_complete.o)

  "_res_9_getservers", referenced from:

      net::internal::ConvertResStateToDnsConfig(__res_9_state const&, net::DnsConfig*) in libCronet.a(cronet_static_complete.o)

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)



We need to use static library instead of the dynamic library.


Any help would be appreciated


Thanks

Rajesh

Misha Efimov

unread,
Apr 24, 2018, 2:19:34 PM4/24/18
to Rajesh Mahindra, Rajesh Mahindra, net-dev
These res_* symbols are coming from system "resolv" library, which is listed here.
I'm not sure why linker doesn't pick it up, maybe it cannot find it?

I would check command line to see whether "libresolv" is present.

Rajesh Mahindra

unread,
Apr 24, 2018, 2:25:09 PM4/24/18
to Misha Efimov, Rajesh Mahindra, net-dev
Hi Misha 

Thanks for your reply.  Yes, it worked by adding -lresolv

Rajesh

To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+u...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+u...@chromium.org.

To post to this group, send email to net...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+u...@chromium.org.

To post to this group, send email to net...@chromium.org.

Misha Efimov

unread,
Apr 24, 2018, 2:30:13 PM4/24/18
to Rajesh Mahindra, Rajesh Mahindra, net-dev
Ah, cronet_static_complete being just a static library cannot specify its link time dependencies so you have to add -lresolv.

You should be able to use cronet_static_framework target which produces static Cronet.framework, which should pick it up automagically.

To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.

To post to this group, send email to net...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.

To post to this group, send email to net...@chromium.org.



--
Take Care,
Rajesh Mahindra



--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.

To post to this group, send email to net...@chromium.org.

chirag...@gmail.com

unread,
May 13, 2019, 1:29:27 PM5/13/19
to net-dev
Hey,
I wanted to know how cronet will help in the following scenarios:
1. Connection times- how does it compare to URLSession and how does it bring these improvements?
2. Impact on performance - what performance metrics are affected.
3. Handoffs- how does it handle handoffs and how is its approach better than the normal usage of URLSessions?
4. Is there any documentation comparing cronet vs non-cronet networking stacks on iOS?
Thanks in advance.

Misha Efimov

unread,
May 13, 2019, 1:53:58 PM5/13/19
to chirag...@gmail.com, net-dev
Hi Chirag, thanks for your questions!

biggest networking performance improvements of Cronet vs system network stack are realized when both client and server are able to use QUIC (HTTP/3) protocol.

QUIC provides 0-rtt connection establishment, and removes H2 head-of-line blocking for multiple streams that use the same session.
These improvements are most pronounced in bad networks with round trip latency and frequent packet loss.

Unfortunately we don't have any performance numbers that we can share at this time.

On Mon, May 13, 2019 at 1:29 PM <chirag...@gmail.com> wrote:
Hey,
I wanted to know how cronet will help in the following scenarios:
1. Connection times- how does it compare to URLSession and how does it bring these improvements?
2. Impact on performance - what performance metrics are affected.
3. Handoffs- how does it handle handoffs and how is its approach better than the normal usage of URLSessions?
 
Could you elaborate on this question? One of limitations if Cronet implementation of NSURLSession API is that it cannot be used for background sessions.
 
4. Is there any documentation comparing cronet vs non-cronet networking stacks on iOS?

Not really. There are build instructions here and cronet_consumer sample app.
 
Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+u...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/d631ecea-b5ef-428b-8ac5-f356f2dd9a5f%40chromium.org.

chirag...@gmail.com

unread,
May 19, 2019, 5:42:29 AM5/19/19
to net-dev, chirag...@gmail.com
Hey,

Thanks Misha. I was able to run Cronet successfully however I got this error highlighted in my console.

1. [0519/145953:ERROR:dns_config_service_posix.cc(213)] DNS config watch failed to start.

Can you help me in resolving the above?

2. Also, as per the documentation, we have to pass the URLSessionConfiguration: `Cronet.install(into: URLSessionConfiguration.default)`
But, in day-to-day networking, configuration may differ based on different network requirements. So, if I have configuration C1 and configuration C2, do I have to do something like this:
`Cronet.install(into: C1)` and then,
`Cronet.install(into: C2)` ?

I did the above but in the instruments, I find leaks when I call install twice.
What’s the recommended approach to deal with this requirement?

3. The active threads(used by Cronet) in the debugger view: there is a Chrome IO thread, some worker pools, SimpleCacheWorker and other threads which cronet uses internally.
I would really appreciate if you can redirect me to a resource which talks about what they do, how’s the caching working, what little improvements do they contribute as compared to the default behaviour.

Screenshot 2019-05-19 at 12.00.25 PM.png

Thanks a lot.

On Monday, May 13, 2019 at 11:23:58 PM UTC+5:30, Misha Efimov wrote:
> Hi Chirag, thanks for your questions!
>
>
> biggest networking performance improvements of Cronet vs system network stack are realized when both client and server are able to use QUIC (HTTP/3) protocol.
>
>
> QUIC provides 0-rtt connection establishment, and removes H2 head-of-line blocking for multiple streams that use the same session.
> These improvements are most pronounced in bad networks with round trip latency and frequent packet loss.
>
>
> Unfortunately we don't have any performance numbers that we can share at this time.
>
>
> On Mon, May 13, 2019 at 1:29 PM <chirag...@gmail.com> wrote:
> Hey,
>
> I wanted to know how cronet will help in the following scenarios:
>
> 1. Connection times- how does it compare to URLSession and how does it bring these improvements?
>
> 2. Impact on performance - what performance metrics are affected.
>
> 3. Handoffs- how does it handle handoffs and how is its approach better than the normal usage of URLSessions?
>
>  
> Could you elaborate on this question? One of limitations if Cronet implementation of NSURLSession API is that it cannot be used for background sessions.
>  
> 4. Is there any documentation comparing cronet vs non-cronet networking stacks on iOS?
>
>
>
> Not really. There are build instructions here and cronet_consumer sample app.
>  
> Thanks in advance.
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "net-dev" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to net...@chromium.org.

Misha Efimov

unread,
May 20, 2019, 11:20:43 AM5/20/19
to chirag...@gmail.com, net-dev
On Sun, May 19, 2019 at 5:42 AM <chirag...@gmail.com> wrote:
Hey,

Thanks Misha. I was able to run Cronet successfully however I got this error highlighted in my console.

1. [0519/145953:ERROR:dns_config_service_posix.cc(213)] DNS config watch failed to start.

Can you help me in resolving the above?
 
This is a benign error message that should've been removed a year ago: https://bugs.chromium.org/p/chromium/issues/detail?id=611467#c9
How old is your checkout? In any case it should be safe to ignore.
 

2. Also, as per the documentation, we have to pass the URLSessionConfiguration: `Cronet.install(into: URLSessionConfiguration.default)`
But, in day-to-day networking, configuration may differ based on different network requirements. So, if I have configuration C1 and configuration C2, do I have to do something like this:
`Cronet.install(into: C1)` and then,
`Cronet.install(into: C2)` ?

I did the above but in the instruments, I find leaks when I call install twice.
What’s the recommended approach to deal with this requirement?

I'd recommend looking at cronet_consumer and test for examples of usage.
I don't have any direct recommendation, but if you can make a small test app that reproduces the issue, I would recommend to file a bug at https://crbug.com.
 

3. The active threads(used by Cronet) in the debugger view: there is a Chrome IO thread, some worker pools, SimpleCacheWorker and other threads which cronet uses internally.
I would really appreciate if you can redirect me to a resource which talks about what they do, how’s the caching working, what little improvements do they contribute as compared to the default behaviour.

Cronet is a thin wrapper around Chromium Network stack, so good starting point is https://www.chromium.org/developers/design-documents/network-stack
 

Screenshot 2019-05-19 at 12.00.25 PM.png

Thanks a lot.

On Monday, May 13, 2019 at 11:23:58 PM UTC+5:30, Misha Efimov wrote:
> Hi Chirag, thanks for your questions!
>
>
> biggest networking performance improvements of Cronet vs system network stack are realized when both client and server are able to use QUIC (HTTP/3) protocol.
>
>
> QUIC provides 0-rtt connection establishment, and removes H2 head-of-line blocking for multiple streams that use the same session.
> These improvements are most pronounced in bad networks with round trip latency and frequent packet loss.
>
>
> Unfortunately we don't have any performance numbers that we can share at this time.
>
>
> On Mon, May 13, 2019 at 1:29 PM <chirag...@gmail.com> wrote:
> Hey,
>
> I wanted to know how cronet will help in the following scenarios:
>
> 1. Connection times- how does it compare to URLSession and how does it bring these improvements?
>
> 2. Impact on performance - what performance metrics are affected.
>
> 3. Handoffs- how does it handle handoffs and how is its approach better than the normal usage of URLSessions?
>
>  
> Could you elaborate on this question? One of limitations if Cronet implementation of NSURLSession API is that it cannot be used for background sessions.
>  
> 4. Is there any documentation comparing cronet vs non-cronet networking stacks on iOS?
>
>
>
> Not really. There are build instructions here and cronet_consumer sample app.
>  
> Thanks in advance.
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "net-dev" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to net...@chromium.org.
>
> To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/d631ecea-b5ef-428b-8ac5-f356f2dd9a5f%40chromium.org.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+u...@chromium.org.
To post to this group, send email to net...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/e6ae8557-ac81-42a0-bb48-46af10ab9485%40chromium.org.

chirag...@gmail.com

unread,
May 21, 2019, 12:15:52 AM5/21/19
to net-dev
Sure, thanks a lot Misha for your help...

aofen...@gmail.com

unread,
Jul 4, 2019, 4:25:40 AM7/4/19
to net-dev, rmah...@uber.com, rmah...@gmail.com
在 2018年3月29日星期四 UTC+8上午3:09:37,Misha Efimov写道:
> To unsubscribe from this group and stop receiving emails from it, send an email to net...@chromium.org.
>
>
>
>
> To post to this group, send email to net...@chromium.org.
>
> To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/2f941eba-ea8c-48bf-889b-11b183c6f0a9%40chromium.org.
>
>
>
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "net-dev" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to net...@chromium.org.
>
> To post to this group, send email to net...@chromium.org.
>
>
>
> To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/CAMPitreZ%2Bg1OzSr5Y7KtUcn2g4FJwvHaNU8%3Ds4z7abm2hsZPcA%40mail.gmail.com.
>
>
>
>
>
>
> --
>
>
>
>
>
>
>
>
>
>
>
> Take Care,
> Rajesh Mahindra
>
>
>
>
>
>
>
>
>
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "net-dev" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to net...@chromium.org.
Hi Misha, I have post an question here: https://groups.google.com/a/chromium.org/d/msg/net-dev/79g9EUB4hqQ/3MUMqd_hDgAJ
If you have met this trouble? Or you can make a test, the trouble make me crazy.
Reply all
Reply to author
Forward
0 new messages