Hello, Pinot Team. I have a question. Thank you al...
# troubleshooting
u
Hello, Pinot Team. I have a question. Thank you always. I am using Pinot to display statistical data on a web page. During my load testing, the results were significantly different from my expectations, so I would like to ask for your advice. I expected that Experiment 2 would at least perform better than Experiment 1, if not twice as fast. I am aware that the Xmx value is not very high. However, I still expected Experiment 2 to perform at least better than Experiment 1. Because the broker will route queries to two servers, I expect the throughput to improve. However, the response time actually increased instead of improving. 1. Is there any reason why the throughput has actually worsened? 2. What can I do to achieve better performance?
Copy code
cluster ENV
env : k8s
version : 1.1.0

The results were checked using Grafana, and the metrics used were pinot_broker_queryExecution_75thPercentile and pinot_broker_queryExecution_50thPercentile.

# Experiment 1
## Environment: 1 server (Xmx 5G), 1 broker (Xmx 1G)
## Total tables: 14, with 1 segments replica per table
## Results:
   P75: 636 ms,  p50 : 465 ms

# Experiment 2
## Environment: 2 servers (Xmx 5G each), 2 brokers (Xmx 1G each)
## Total tables: 14, with 2 segments replica per table (rebalance executed)
## Results:
   P75: 1380 ms, P50: 1020 ms

Each table has approximately 100 segments, with a size of around 10MB per table.
I would appreciate any insights on how to achieve better performance. Thank you!
x
it will get you better qps
u
Yes, thank you so much for your response. However, I initially expected that increasing the number of servers and brokers would lead to better performance. What could be the reason that this is not the case? The performance has actually become slower.
In my current situation, there isn’t a large amount of data. I have also confirmed from the logs that queries are being distributed when the number of servers increased from one to two. I need to report this to my colleagues, but I am not sure of the exact reason.
x
Query fan out might increase the p95 as some slow server will contribute to the latency while the fast server already returned
from the query result, can you check if each query hit two servers or just 1 server?
change the query routing to replica group, so each query will only hit any server, that’s usually the best for the query perf for high qps case
u
Yes, I understand that p95 could be affected in that way. However, both p50 and p75 have also nearly doubled. Yes, I changed the segment replica count to 2 for all table configurations, increased the number of servers to 2, and checked the logs. I confirmed that query logs exist on both servers.
from the query result, can you check if each query hit two servers or just 1 server?
x
your current setup will help for reducing large queries latency
what the qps and I suspect cpu is saturated, hence the latency went up
u
It’s about 300 queries. I’m sorry for asking the same question repeatedly. It’s not stubbornness; I just want to understand. How should I interpret the fact that, even though queries are distributed when adding more servers, the performance has actually decreased?
x
can you just run 1 query and compare the query latency
and check the latency change when your cpu workload is increasing
thinking of you are testing with 1/10/20/50/100/200/300 qps and check the latency numbers
u
No, there are multiple statistical queries being executed on a specific web page. Approximately 50 different queries are being repeatedly called.
x
do you have cpu metrics ?
u
Yes, wait please.
This is 1 server, 1 broker.
This is 2 servers, 2 brokers.
x
then it means your pinot servers are cpu bound
so this means you need to give more cpu
u
Umm.. That is k8s.
resources -> limits
is not set. As you know, 100% means 1vcpu.
You can see 246% on broker in first image.
x
so the p50 is better with 2 servers
which means the latency does drop
p75 and p99 is due to the slow query which might contribute more due to the fan out as I mentioned before
p50 is 439 vs 49
ah
I looked at wrong numbers
u
ye, It's okay!!
x
so if you compare, after you double brokers, broker cpus got half each, so it means the total workload is not blocked by broker
and if you look at server side, both of them are getting 100%, which means both of them are running query still
in you case, because server cpu resources is not enough, so queries might be queued or waiting on threads execution
in this case, the latency is kind of unpredictable
u
Yes, something seems off to me as well. The broker’s CPU usage has decreased. However, the server’s usage remains the same whether there is one or two servers.
x
it means server is fully used because of query workload is higher
so you need to double the capacity again
say double cpu and memory
u
Umm. However, when the CPU and memory the same, it is strange that even after increasing the number of servers and brokers, the server load remains the same, and the speed has actually slowed down.
x
it’s saturated.
which means server is already under resource
after you add 1 more server, it’s still under resources
it means you may need 1 broker and 4 servers in your set up
servers are the bottleneck
u
Then, as you mentioned, I will test with 1 broker and 4 servers. And of course, I should set the segment replication factor to 4, right? (If I’m not using replica groups).
x
in short, suggest to do your next benchmark with: 1. scale servers to 4, 2. using replica group Then check the cpu usage to ensure it’s not saturated
yes, use replica group and 4 replicas
u
Once again, thank you for taking the time for me, and I’m sorry. 😭
Yes, I’ll test it and share the results with you.
x
👍
u
At first, scale server to 4. (segment replica factor : 4)
x
2.configure the replica group
3. rebalance table with instance re-assignment
u
Are you saying that I should apply steps 1, 2, and 3 all at once, or should I apply them sequentially?
x
4 ensure you set route
Copy code
"routing": {
      "instanceSelectorType": "replicaGroup"
    },
sequentially
u
Okay. I think steps 2, 3, and 4 should be tested together after step 1. So, there are a total of two test cases, right? Also, for the second test (where steps 2, 3, and 4 are combined), I plan to keep 4 servers. What should the replication factor be in this case?
# test case1 result • env ◦ broker : 1 ◦ server : 4 (each Xmx : 5G) ◦ segment replica : 4 (after increase I did rebalance) • query latency ((pinot_broker_queryExecution_50,75thPercentile) ◦ p50 : 686 ms ◦ p75 : 906 ms • summary : It is slower than when there was only 1 server. And still server cpu usage is same (4 servers are 100 ~ 140)
image.png
x
have you done replica group?
can you try that especially for the tables with large latency
100% means the peak time servers are still not enough.
u
Not yet. I haven’t used replica groups before, so I need some time. I also need to read the documentation.
x
use replica group could help routing to only one server for a full query. This will reduce the query latency
ok
I would say, that’s the right scaling factor for you right now
u
I am trying to set replica group as you told me. Also, routing configuration will also set
replicaGroup
. I am very confused about
instanceAssignmentConfigMap
. I end up having to run 2 pinot servers. (understand me plz) If I set
numReplicaGroups
value to 2 and
numInstancePerReplicaGroup
value to 1, will data be lost if one server dies?
And according to the document below, queries span across servers based on the value set for "numInstancePerReplicaGroup". If Pinot has 2 servers and is configured with numReplicaGroups: 2 and numInstancePerReplicaGroup: 2, I think using Replica Group may not be meaningful in this case.
https://docs.pinot.apache.org/operators/operating-pinot/tuning/routing#:~:text=As%20seen%20above,group%20(4%20servers).
each query will span to a single replica group (4 servers).
The reason I said it is meaningless is that I believe the situation is the same as the previous test where Pinot servers: 2, Segment replicas: 2.
x
with replicaGroup you will need to run 2 servers, and configure
numReplicaGroups
value to 2 and
numInstancePerReplicaGroup
value to 1. So if one server die, you still have another server for the query
think of each server has the full data
u
I understood that if the
numInstancePerReplicaGroup
value is 1, the data would exist on only one of the two servers. It seems I was wrong. Thank you so much for your response. I will probably be able to share the test results within today.
I add this configurations. And then, I ran
server rebalance
. How can I check replica group of segments?
Copy code
"instanceAssignmentConfigMap": {
        "CONSUMING": {
          "tagPoolConfig": {
            "tag": "DefaultTenant_REALTIME",
            "poolBased": false,
            "numPools": 0
          },
          "replicaGroupPartitionConfig": {
            "replicaGroupBased": true,
            "numReplicaGroups": 2,
            "numInstancesPerReplicaGroup": 1
          }
        },
        "COMPLETED": {
          "tagPoolConfig": {
            "tag": "DefaultTenant_REALTIME",
            "poolBased": false,
            "numPools": 0
          },
          "replicaGroupPartitionConfig": {
            "replicaGroupBased": true,
            "numReplicaGroups": 2,
            "numInstancesPerReplicaGroup": 1
          }
        }
      },
      "routing": {
        "instanceSelectorType": "replicaGroup"
      },
x
from idealState
each segment should be assigned to both servers
u
I think my understanding of Pinot is still lacking. I’m sorry, but could you explain it in more detail? And I don’t fully understand what Ideal State means.
x
it’s the data assignment

https://www.youtube.com/watch?v=MAHaMMdJV2A▾

u
If what you mentioned refers to the following, then it can provide information about the segment, but it does not include information about the
replica group
.
Copy code
{
  "id": "assessment_submitted_REALTIME",
  "simpleFields": {
    "BATCH_MESSAGE_MODE": "false",
    "IDEAL_STATE_MODE": "CUSTOMIZED",
    "INSTANCE_GROUP_TAG": "assessment_submitted_REALTIME",
    "MAX_PARTITIONS_PER_INSTANCE": "1",
    "NUM_PARTITIONS": "2",
    "REBALANCE_MODE": "CUSTOMIZED",
    "REPLICAS": "2",
    "STATE_MODEL_DEF_REF": "SegmentOnlineOfflineStateModel",
    "STATE_MODEL_FACTORY_NAME": "DEFAULT"
  },
  "mapFields": {
    "assessment_submitted__0__0__20250115T0143Z": {
      "Server_pinot-server-0.pinot-server-headless.pinot.svc.cluster.local_8098": "ONLINE",
      "Server_pinot-server-1.pinot-server-headless.pinot.svc.cluster.local_8098": "ONLINE"
    },
    "assessment_submitted__0__1__20250116T0143Z": {
      "Server_pinot-server-0.pinot-server-headless.pinot.svc.cluster.local_8098": "CONSUMING",
      "Server_pinot-server-1.pinot-server-headless.pinot.svc.cluster.local_8098": "CONSUMING"
    }
  },
  "listFields": {}
}
x
that is not here, it’s in your table config
and you could find the instance assignment in zookeeper PropertyStore
u
Thank you!! In zookeeper browser ( /pinot/PROPERTYSTORE/SEGMENTS/{TABLE_NAME}/{SEGMENT_NAME}) shows below. There is no information for replica group. Umm.
Copy code
{
  "id": "assessment_submitted__0__0__20250115T0143Z",
  "simpleFields": {
    "segment.crc": "1824880839",
    "segment.creation.time": "1736905415825",
    "segment.download.url": "s3://aidt-pinot-dev/terry-test-controller-data/assessment_submitted/assessment_submitted__0__0__20250115T0143Z",
    "segment.end.time": "1736499134061",
    "segment.flush.threshold.size": "100000",
    "segment.index.version": "v3",
    "segment.realtime.endOffset": "152",
    "segment.realtime.numReplicas": "1",
    "segment.realtime.startOffset": "108",
    "segment.realtime.status": "DONE",
    "segment.start.time": "1736324461469",
    "segment.time.unit": "MILLISECONDS",
    "segment.total.docs": "6"
  },
  "mapFields": {},
  "listFields": {}
}
Do you have any comments to share plz?
x
this is segment metadata, so in the
/pinot/PROPERTYSTORE/IDEALSTATES
you can find each segment is served by 2 servers
or in pinot broker api, you can query for the routingTable and see if it’s only pointing to one server
it means your single query won’t be scattered to 2 servers
u
In /pinot/IDEALSTATES show below image. there is no zookeeper tree
/pinot/PROPERTYSTORE/IDEALSTATES
I think
mapFields
just show segment information not replica group.
x
you are right
then this means each segment is on two servers
so check your routing table, if routing only hit one server for all the segments then you are good
u
Yes, I searched for the broker API you mentioned. I was only able to find APIs related to query execution. Could you provide information about the routing-related APIs?
x
try this api:
/debug/routingTable/{tableName}
u
$ curl -X GET "http://localhost:9000/debug/routingTable/assessment_submitted" {"code":404,"error":"HTTP 404 Not Found"}*%* $ curl -X GET "http://localhost:9000/debug/routingTable/tables/assessment_submitted" {"code":404,"error":"HTTP 404 Not Found"}*%*
Umm not working .
x
it’s not controller api, it’s broker api
port is different
u
ok
x
8099?
u
the result show below
Copy code
curl -X GET "http://localhost:8099/debug/routingTable/assessment_submitted"
{"assessment_submitted_REALTIME":{"Server_pinot-server-1.pinot-server-headless.pinot.svc.cluster.local_8098":["assessment_submitted__0__1__20250116T0143Z","assessment_submitted__0__2__20250305T2326Z","assessment_submitted__0__0__20250115T0143Z"]}}
x
call it multiple times and see if it only shows you one server
then you are good
u
Thank you so much!!!!!!!!!!!!!!!!!. I will share my test. With replica group & partitioning, the performance has improved. And the image is Experiment #4. The load on some servers has also decreased.
Copy code
# Experiment 1
## Environment: 1 server (Xmx 5G), 1 broker (Xmx 1G)
## Total tables: 14, with 1 segments replica per table
## Results:
   P75: 636 ms,  p50 : 465 ms

# Experiment 2
## Environment: 2 servers (Xmx 5G each), 2 brokers (Xmx 1G each)
## Total tables: 14, with 2 segments replica per table (rebalance executed)
## Results:
   P75: 1380 ms, P50: 1020 ms

# Experiment 3 (replica group set)
## Environment: 2 servers (Xmx 5G each), 2 brokers (Xmx 1G each)
## Total tables: 14, with 2 segments replica per table (rebalance executed)
## Results:
   P75: 770 ms, P50: 558 ms

# Experiment 4 (replica group, parttitioning set)
## Environment: 4 servers (Xmx 5G each), 2 brokers (Xmx 1G each)
## Total tables: 14, with 2 segments replica per table (rebalance executed)
## Results:
   P75: 487 ms, P50: 329 ms