mapbox cost too much cpu
オープン
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 438
- フォーク
- 117
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I overwrite the code like here:
public static boolean inRing(PointCustom pt, List<PointCustom> pointCustomList) {
boolean isInside = false;
for (int i = 0, j = pointCustomList.size() - 1; i < pointCustomList.size(); j = i++) {
double xi = pointCustomList.get(i).getLongitude();
double yi = pointCustomList.get(i).getLatitude();
double xj = pointCustomList.get(j).getLongitude();
double yj = pointCustomList.get(j).getLatitude();
boolean intersect = (
(yi > pt.getLatitude()) != (yj > pt.getLatitude()))
&& (pt.getLongitude() < (xj - xi) * (pt.getLatitude() - yi) / (yj - yi) + xi);
if (intersect) {
isInside = !isInside;
}
}
return isInside;
}
but i run it on the production.and find that the cpu of server cost too much ,200% CPU is consumed frequently when send 100 requests per second.
My demand is to locate in the longitude and latitude data of 100000 cities through longitude and latitude。
And the args of varible : pointCustomList storage 100000+ CityInfo object.
What problem can reduce the cost of CPU?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供されているinRingメソッドと、100,000以上の都市で使用されるPointCustomリストから始めます。呼び出し経路を調査し、毎秒100リクエストでワークロードをプロファイリングします。完了の定義は、位置情報の結果を維持しながら、本番環境に相当する負荷の下でCPU使用率の低下を実証することとします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- performance
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 20/100