0

I'm having doubts about a need to use a singleton pattern in a web service.
I'm building a web service that is acting as a server side for multiple clients. I was thinking about making my business logic classes a singleton classes but i'm having doubts because of the following scenario:

When the web service receives calls from multiple clients simultaneously to invoke the same method,i assume that they all have to wait in a queue because there is only one business logic instance.

On the other hand, having the same scenario without using a singleton will cause multiple business logic instances, one instance for each client.

I would love to receive a recommendation or a best practice for my scenario.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by hericles
0

You would only want a singleton class if the information being supplied by the web service is the same for everyone.
Having multiple business logic instances created (one per user) isn't (shouldn't be) an issue. That is how web servers are designed to work. Its the same as the server serving up multiple versions of the same web page when a lot of users are viewing the site. Unless your instances take up a lot of memory but thats different issue.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.