Em có thắc mắc nhỏ, các hệ thống bên anh xử lý 1 triệu đến 1 tỷ request/s hoặc phút như nào. Giả sử 1 thread xử lý 1 request, như vậy phải cần đến 1 triệu thread để xử lý song song không ạ
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Không em ạ. Bản thân mỗi thread sẽ tốn 1 số lượng tài nguyên nhất định. Ví dụ với Java là 2MB đi. Vậy với số lượng RAM có hạn của máy tính thì mình không thể tạo bừa bãi thread được.
2. Thay vào đó là các hệ thống sẽ cần sử dụng hữu hạn số lượng thread, cao nhất chắc cũng chỉ vài trăm là cùng. Tổ chức các thread này thành dạng thread pool để tái sử dụng. Kết hợp giữa event loop và queue để điều hướng dữ liệu em ạ. Em tham khảo thêm bài viết này để hiểu thêm nhé.