Hello,

you'll need to define "fallen apart". What did not work and why? Obviously a
singleton is single in one Worker (one JVM). For DB connections, this seems
to be a good thing - you'll want every JVM to have a single (or, rather, a
limited pool of) DB connection encapsulated in a singleton resource.




If you want a singleton to really be single in the topology, you'll need to
abstract away the DB connection logic to a separate microservice, or a
single bolt.




PJ




---------- Původní e-mail ----------
Od: Denis Sevosteenko <[email protected]>
Komu: [email protected]
Datum: 15. 7. 2019 15:08:26
Předmět: Storm and singletons
"

Hi all,





This may be an old question, but what is the correct way of using Singleton
pattern with Storm?




Currently we have a topology with around 200 bolts, of which around 50 read
and write data from/to Cassandra. Each of these 50 bolts creates a new
Cassandra session, which to my understanding of Cassandra is not great. We
have tried solving this issue with several implementations of singletons: 
lazy static, eager static and enum. All of these implementations have worked
in dev environment running on single server, but have fallen apart on QA 
environment which has two supervisor hosts. I'm new to Storm so I have no 
idea if we are missing something crucial or obvious.




Thanks & Regards,

Denis Sevosteenko


"

Reply via email to