-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apache の処理の仕方を見直し、画像の表示に時間がかかっている問題を解消する #67
Comments
KeepAlive 関連の設定off『Slow web responses to mobile devices clog my apache workers』を参考にして、apache の Keep-alive を off にしてみる 全ての画像取得が 1 秒ほどで返ってくるようになった? 1001316
apache ログ
それっぽい値に設定する以下のように設定してみた。 |
Timeout を変更KeepAlive の対応で、apache の返す処理自体は早くなった気がする(ブラウザ確認)。 そこで、Android の API 呼び出し部分にもログを仕込み時間を調査した。 Interceptor を用意し、Retrofit に噛ませる internal class LoggingInterceptor : Interceptor {
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
val request: Request = chain.request()
val t1 = System.nanoTime()
val response: Response = chain.proceed(request)
Log.d("hoge", "${response.request.url}, ${(t2 - t1) / 1e6}, ${response.headers}")
Timber.tag("hoge").d("${(t2 - t1) / 1e6} m sec")
return response
}
}
val okHttpClient = OkHttpClient.Builder()
.addInterceptor(LoggingInterceptor())
.build()
return Retrofit.Builder()
.baseUrl(Constants.BASE_URL)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(SakamichiApi::class.java) 結果
Connection Timeout を設定してみる以下のように、Retrofit 作成時に connectionTimeout を指定。 val okHttpClient = OkHttpClient.Builder()
// ここ!
.connectTimeout(500, TimeUnit.MILLISECONDS)
.addInterceptor(LoggingInterceptor())
.build()
return Retrofit.Builder()
.baseUrl(Constants.BASE_URL)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(SakamichiApi::class.java) 結果
方針的に良さそうだが、画像は遅いまま。 → apache の方に Timeout を持たせたら? |
ConnectionTimeout を設定したら解決するということは、モバイルの時のみなぜかコネクションが閉じてない、っていうことっぽい。 9bde471e-56a8-4506-9db9-479a6563952a.mp4 |
通信待ち時通信を待っている間の UI について、こちらの記事を参考に考えてみた。 スケルトンスクリーン なるものが今きてるっぽい? スケルトンスクリーン
Links |
apache の処理の仕方を変更し、問題を解消する
調査チケット: #66
別チケットで調査済み
The text was updated successfully, but these errors were encountered: