I send prices to clients (10000+), but below the code has a loop that causes delays in the process for clients awaiting calculation.
PriceVisibleForCustomer = Price + CustomerMargin
Price - changes every 300 ms - sent from a central store that is not related to the customerβs instance
CustomerMargn - a certain amount of plus or minus resulting from an agreement with a client / segment / administrator, etc. It does not change during the http client session, I can save it in memory
Client - he takes part in this process after entering the system, he should see rapidly changing prices for 8 products.
Maybe I need some more technology? I have Spring 3/4, Java, Weblogic, and I could even create a separate webapp for this task to provide estimated prices.
I was thinking of threads in Java, but 10,000+ clients would mean too many threads, right? How to change this code? Maybe I need to change the architecture, but how?
private static void sendPricesToCustomers(Long productId, Map<Long, BigDecimal> productIdToPriceMap, Map<Long, BigDecimal> customerIdToMarginMap) {
user1308908
source share