Extreme slow down when using Map#lock/unlock from multiple threads [API-1968]
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- distributed-systems
Hướng nghiên cứu
Bắt đầu bằng cách chạy trình tái hiện Python được cung cấp với một Hazelcast client, nhiều thread và Map#lock/unlock, sau đó kiểm tra các đường dẫn client được sử dụng bởi khóa map blocking và các thao tác lock, get, put và unlock. Công việc được xem là hoàn tất khi xác định được lý do thực thi đồng thời chậm hơn đáng kể so với thực thi tuần tự và xác minh rằng workload được báo cáo không còn bị chậm nữa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Running the Pessimistic Locking example from multiple threads using the same client takes vastly different amounts of time.
The sequential runs of the same code can give:
It took 68.364421721 second(s) to finish.
It took 2666.208992902 second(s) to finish.
Using one Hazelcast instance. The behaviour is reproducible on MacOS and Linux. Using python3
The code sample:
import hazelcast
from time import perf_counter
from concurrent.futures import ThreadPoolExecutor
from threading import Thread
if __name__ == "__main__":
client = hazelcast.client.HazelcastClient(
cluster_name="dev",
lifecycle_listeners=[
lambda state: print("Lifecycle event >>>", state),
]
)
# Defining send_query func and pooled_query func, to send requests using ThreadPoolExecutor
desired_range = range(10000)
desired_threads = 10
# Create a Distributed Map in the cluster
counter_map = client.get_map("counter-map").blocking()
counter_map.put("key", 0)
# Pesimistic Locking
def send_query(range_parameter):
for i in range_parameter:
counter_map.lock("key")
try:
counter = counter_map.get("key") + 1
counter_map.put("key", counter)
finally:
counter_map.unlock("key")
def pooled_query():
# create the thread pool
n_threads = desired_threads
with ThreadPoolExecutor(n_threads) as executor:
# push query for each thread
_ = [executor.submit(send_query, desired_range) for i in range(0, desired_threads)]
def pooled_query_thread():
threads = []
for i in range(desired_threads):
thread = Thread(target=send_query, args=(desired_range,))
threads.append(thread)
for thr in threads:
thr.start()
for thr in threads:
thr.join()
## Timer start
start = perf_counter()
## Invoke ThreadPoolExecutor to send requests
if __name__ == "__main__":
# pooled_query()
pooled_query_thread()
## Timer end
finish = perf_counter()
print(f'It took {finish-start} second(s) to finish.')
for key, value in counter_map.entry_set():
print(key, value)
client.shutdown()
- Ngôn ngữ chính
- Python
- Star
- 115
- Fork
- 78
- Merge trung bình
- 2 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của hazelcast/hazelcast-python-client
-
Type: Test-Failure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Type: Test-Failure
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
-
asyncio Type: Test-Failure
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
-
asyncio to-jira Type: Test-Failure
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
hazelcast/hazelcast-python-client#761 · 1 bình luận ·
-
asyncio to-jira Type: Test-Failure
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
hazelcast/hazelcast-python-client#760 · 1 bình luận ·
Tất cả issue của hazelcast/hazelcast-python-client
Issue tương tự
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
aws-samples/sample-spec-driven-presentation-maker#648 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
firestore: enable live window.yaml pipeline system tests once add_window_fields is in productionĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 64/100
googleapis/google-cloud-python#19115 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Feyisara2108/stellargive#1377 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CRS WKT default to WKT2Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày