{ "id": "170923", "key": "TIMOB-25941", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "20220", "name": "Release 7.3.1", "archived": false, "released": true, "releaseDate": "2018-08-30" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-08-24T21:22:18.000+0000", "created": "2018-01-24T16:51:45.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android", "httpclient", "performance" ], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-08-27T12:52:24.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Performance of HTTP Client on Android is rather sub-par when compared to how it performs on iOS. Speed and responsiveness is just not there and has never been. It also seems to be hard on resources that can really slow down the performance of the phone/app as a whole when there are multiple HTTP requests happening at once or in succession. \r\n\r\nHere is a basic bit of code that just does a download of a 100 Mb file and shows the speed of the download and time. In the image attached you can see the performance difference between a iPhone and Android phone running the same app. The android phone is more the capable of the same download speed as the iPhone is showing, when using react or when creating a web view to do the same thing I can get over 150 Mbps on the Android phone. \r\n\r\nSample code:\r\n\r\n{code:java}\r\nvar xhr = null;\r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff',\r\n fullscreen: false, navBarHidden: true, exitOnClose: true, theme: \"Theme.materialTheme\", orientationModes: [Titanium.UI.PORTRAIT]\r\n});\r\n \r\nvar runTime = Ti.UI.createLabel({\r\n text: 'Run Time...',\r\n top: 50,\r\n left: 10,\r\n color: '#000'\r\n});\r\n\r\nvar downloadSpeed = Ti.UI.createLabel({\r\n text: '0.00 Mbps',\r\n top: 90,\r\n left: 10,\r\n color: '#000'\r\n});\r\n\r\n \r\nvar buttonStart = Ti.UI.createButton({ title: \"START\", width: 100, height: 40, top: '45%', left: '10%' });\r\nvar buttonStop = Ti.UI.createButton({ title: \"STOP\", width: 100, height: 40, top: '45%', right: '10%' });\r\n\r\n\r\nbuttonStart.addEventListener(\"click\", function() {\r\n\r\n var startTime = new Date().getTime();\r\n var totalPercent = 0;\r\n\r\n xhr = Titanium.Network.createHTTPClient({\r\n ondatastream: function(e) {\r\n totalPercent = (e.progress).toFixed(2);\r\n var currentTime = new Date().getTime();\r\n var timeDiff = ((currentTime-startTime)/1000).toFixed(2);\r\n var totalDownloaded = (102400 * totalPercent);\r\n var currentKBPS = (((((totalDownloaded * 1024) * 8.192) / timeDiff) / 1024 / 1024)).toFixed(2);\r\n\r\n runTime.text = timeDiff;\r\n downloadSpeed.text = currentKBPS + ' Mbps';\r\n },\r\n onload: function() {\r\n alert('All Finished!');\r\n },\r\n timeout: 10000\r\n });\r\n\r\n xhr.open('GET','http://mirror.lstn.net/st/test100.zip');\r\n xhr.send();\r\n\r\n});\r\n\r\n\r\nbuttonStop.addEventListener(\"click\", function() {\r\n xhr.abort();\r\n});\r\n\r\n\r\nwin.add(runTime);\r\nwin.add(downloadSpeed);\r\nwin.add(buttonStart);\r\nwin.add(buttonStop);\r\nwin.open();\r\n{code}", "attachment": [ { "id": "64737", "filename": "IMG_1279.jpg", "author": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-24T16:42:49.000+0000", "size": 1010089, "mimeType": "image/jpeg" }, { "id": "64738", "filename": "IMG_1281.jpg", "author": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-24T17:19:18.000+0000", "size": 1615235, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "Android: HTTPClient downloads are slower compared to iOS", "creator": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1065, "state": "closed", "name": "2016 Sprint 17 SDK", "startDate": "2018-08-13T17:39:36.846Z", "endDate": "2018-08-27T17:39:00.000Z", "completeDate": "2018-08-29T16:10:57.013Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "433593", "author": { "name": "jkneen", "key": "jkneen", "displayName": "Jason Kneen", "active": false, "timeZone": "Africa/Ceuta" }, "body": "Is it consistently slower? Can you try a speedtest app / speedcheck app on both devices to see what throughput you're getting?\r\n\r\nMy concern is that these are two different devices on a network -- and whilst they should both be fast, it's not a great test because one could (for some reason) be accessing the network more slowly.\r\n\r\nHave you tried running simulator and emulator on the *same* host machine -- so both are piggy backing the same wifi / hard-wired connection. Obviously they'd be some differences still between emulator / simulator etc, but the network connection should be the same for both so might be a better test.\r\n", "updateAuthor": { "name": "jkneen", "key": "jkneen", "displayName": "Jason Kneen", "active": false, "timeZone": "Africa/Ceuta" }, "created": "2018-01-24T17:05:14.000+0000", "updated": "2018-01-24T17:05:14.000+0000" }, { "id": "433594", "author": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Jason, \r\n\r\nYes it is consistently slower. I attached another screen shot showing both devices after running a speed test. The Android phone is a Ti app with the speed test taken in a web view. One after the other the test was not performed at the same time. \r\n\r\nIn this case they are both using 802.11ac using the same wifi and the Android phone is not some old slow phone. With no other apps running in the background. \r\n\r\nIts not just this device, it doesn't matter what Android device I use I have had this issue since the first day I have used Ti. I have 7 Android phones on my desk right now running all different versions of Android. I also run my own speed test app and I can tell you that this has been a problem for a very long time. The Android HTTPClient just doesn't perform well. \r\n\r\nIt doesn't matter if its running in the emulator or simulator what phone I'm using, the same code on Android will always be many times slower then the same on iOS. \r\n\r\nIf I run multiple HTTPClients at once to do a threaded test the issue is magnified many times over. \r\n\r\nIt's also not like we are talking a 5 or 10 Mbps difference here, its a 100+ Mbps difference just on that single threaded test. \r\n\r\n!IMG_1281.jpg|thumbnail! ", "updateAuthor": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-24T17:29:16.000+0000", "updated": "2018-01-24T17:29:16.000+0000" }, { "id": "433596", "author": { "name": "jkneen", "key": "jkneen", "displayName": "Jason Kneen", "active": false, "timeZone": "Africa/Ceuta" }, "body": "OK good to know, thanks", "updateAuthor": { "name": "jkneen", "key": "jkneen", "displayName": "Jason Kneen", "active": false, "timeZone": "Africa/Ceuta" }, "created": "2018-01-24T17:46:13.000+0000", "updated": "2018-01-24T17:46:13.000+0000" }, { "id": "436216", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~dlewis23], Are you still having the issue?Just following up to check the status of this issue and if you need further help on it. \r\n\r\nPlease let us know. \r\n\r\nThanks", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-04-03T09:00:49.000+0000", "updated": "2018-04-03T09:00:49.000+0000" }, { "id": "436301", "author": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes Mostafizur Rahman, I am still having exactly the same problem. Nothing has changed or gotten better. ", "updateAuthor": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-04-04T20:47:52.000+0000", "updated": "2018-04-04T20:47:52.000+0000" }, { "id": "436561", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I am not able to reproduce the issue as described. I tested the issue in emulator and simulator. My observation is, for the simulator the starting speed is a bit high like 50MBps it shows and for the emulator, it's 39MBps. But, both of them, it does come at a steady speed of 30 odd MBps after some seconds. So, I also think this is a device issue, not the Http client itself. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-04-06T02:56:14.000+0000", "updated": "2018-04-06T02:56:14.000+0000" }, { "id": "436571", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Tried testing too, on emulator/simulator that is. I get the same results for iOS & Android (both around 40-50mbit, where a speedtest shows 200). Tried a more local source of a 100mb file and that results in similar speed for both platforms too.\r\n\r\n[~dlewis23] Is this device only or do you have it on emulator too?", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-04-06T11:51:51.000+0000", "updated": "2018-04-06T11:51:51.000+0000" }, { "id": "436577", "author": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes of course I see this in the emulator. But the emulator is irrelevent because people aren't running my apps in the emulator his happens on all devices that I test on. It happens on everything from a LG G2 all the way to a Samsung Galaxy S8 and Google Pixel 2 XL. It happens on all. \r\n\r\nAnd the problem gets magnified as you run multiple threads as I'm trying to do. *Your also not going fast enough to see the problem.* You should be much faster than 40 - 50 Mbps, especially if a speed test shows your internet speed as 200 Mbps. Please change the 100 mb download file its using to the closest one to you from the list here to eliminate any routing/distance factors of download speed : https://www.linode.com/speedtest\r\n\r\nIt doesn't matter if its in emulator/simulator or on device I get the same poor performance on android no matter what device vs iOS. An example right now that I just did, I get from the Linode Atlanta test file over 300 Mbps from a single stream on a iPhone X and around 140 on a Galaxy S8 or Pixel 2 XL. Both of those phones should be as fast or faster because of there better antenna design. And if I build with React or do a simple web view I get the same performance as the iPhone X I build with TI and its half. If I add multiple threads the problem gets worse as you take more tests. \r\n", "updateAuthor": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-04-06T14:33:38.000+0000", "updated": "2018-04-06T14:33:38.000+0000" }, { "id": "440953", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10274", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-21T18:05:27.000+0000", "updated": "2018-08-21T18:05:27.000+0000" }, { "id": "440987", "author": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Been testing the PR and so far its much better from the little bit of testing I have done on a Galaxy S8 or older Moto phone. Results in faster speeds and much more consistent results. I would say so far its quite good and not sure if it needs to wait till 7.5.0 to be released. If anything else changes in my testing I will update. ", "updateAuthor": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-22T14:43:23.000+0000", "updated": "2018-08-22T14:43:23.000+0000" }, { "id": "441032", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (7.4.x): https://github.com/appcelerator/titanium_mobile/pull/10283\r\nPR (7.3.x): https://github.com/appcelerator/titanium_mobile/pull/10284", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-24T01:03:38.000+0000", "updated": "2018-08-24T01:03:38.000+0000" }, { "id": "441055", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed.\r\nWaiting for CR to merge.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-24T20:23:32.000+0000", "updated": "2018-08-24T20:23:32.000+0000" }, { "id": "441085", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fix in SDK version: {{7.3.1.v20180824134723}}, {{7.4.0.v20180824134643}} and {{7.5.0.v20180824145645}}.\r\n\r\nTest and other information can be found at: \r\nMaster: https://github.com/appcelerator/titanium_mobile/pull/10274\r\n7_3_X: https://github.com/appcelerator/titanium_mobile/pull/10284\r\n7_4_X: https://github.com/appcelerator/titanium_mobile/pull/10283", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-27T12:52:04.000+0000", "updated": "2018-08-27T12:52:19.000+0000" } ], "maxResults": 21, "total": 21, "startAt": 0 } } }