• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring / Java processing calculations for different clients simultaneusly

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you know similar case with some example for this scenario? How could I implement it in Java / Spring 3/4 application?

I will simplify the scenario so it would be easy to understand. Firstly I am consuming REST / webservice with simple data: id of the product and its price. These data are changing in real time. Each customer logged into application will see different prices (base prices from the endpoint calculated using some margins and segments). Each customer must see these data in possible shortest time, so I could have a map in memory that has simple data for logged customers and their margins so I wouldnt have to query the database. I cant just do a simple loop checking this map because there will be thousands of customers logged in so the last one in the loop would have to wait even more than one second. I also cannot create new thread in Java for every customer logged in can I? Wouldnt it be too many threads?

I am planning to use Spring4 and maybe websockets abstraction in Spring 4 but I don't know how to implement and quarantee low latency for thousands of customers that have different calculations?

PriceVisibleForCustomer = Price + CustomerMargin

Price - changing every 300ms
CustomerMargn - some plus or minus amount that is resulting from customer agreement/segment/administrator decision etc. It doesnt change during customer http session
Customer - he takes part in the process after he logs in, he should see rapidly changing prices of 8 products.


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic