Web API Calling is slower in ios then android ?

Hello ,

I am using Xamarin.Forms for my app development in iOS and Android both and below are technologies are used in this project.
Database : AWS DynamoDB
Server: Windows Server 2012 R2 (AWS EC2 t2.small)
API: .NET WEB API
Xamarin.Forms

I have used ModernHTTPClient as it is faster then the httpClient.

Now my question is when i am calling one WEB API from android it takes around 2-3 second to receive response and when i am calling same api for same user and same set of records for iOS it takes 4-5 seconds which is almost double, so is there any native platform specific issue ? or issue related to ModernHTTPClient ? or xamarin.forms issue ?

Please let me know any suggession or anything i have missed in configuration to speedup api call in iOS.

Thanks,
Brijesh Pandya

Answers

  • Hi @BrijeshPandya please follow this approach it will be help for you..

    using (var client = new HttpClient(new NativeMessageHandler()))
    {
    Uri baseAddress = new Uri(GlobalUserDetail.ServerurlLink + "Login");
    client.BaseAddress = baseAddress;
    var json = JsonConvert.SerializeObject(objlogin);
    var content = new StringContent(json, Encoding.UTF8, "text/json");
    HttpResponseMessage response = null;
    response = await client.PostAsync(baseAddress, content);
    }

  • BrijeshPandya.5833BrijeshPandya.5833 USMember ✭✭

    @mandeep_Singh_Mandy I have used the same code for creating client, as i have mentioned i am using ModernHTTPClient but my question is , any specific reason anyone know why Web API Calling is slower in ios then android ?

  • Hello @BrijeshPandya i think you are using WBI Calling from iPhone's 4 (with iOS 7.1.2 version). Response is slow only on iPhone's 4. please test on latest version of IOS 9.0.

  • Hello @BrijeshPandya can you send me the full method where you call the httpclient or modern http client. web api call.. so, after that i will analysis ur code issue proper where is the problem is IOS version.

  • BrijeshPandya.5833BrijeshPandya.5833 USMember ✭✭

    No, i am using all the iphone devices and my application is support 8.0+ OS device only. Currently checking with iphone 4s 8.2 iOS and iPhone 6 Plus with 10.2 iOS.

  • MexmaMexma INMember ✭✭

    Hello @BrijeshPandya,

    did you figure out why API calling was too slow on iOS?

  • MexmaMexma INMember ✭✭

    @BrijeshPandya and anybody having similar problem, I was able to fix it after using single (shared) instance of HTTPClient.

    here is a wonderful thread talking about HttpClient and xamarin.
    http://jonathanpeppers.com/Blog/improving-http-performance-in-xamarin-applications

Sign In or Register to comment.