Click here to Skip to main content
15,795,581 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more: , +
Hi Expert,

I have faced the interview in some company where they have given me a problem.But still, I do not find the solution.So could you please help me to give the solution.

We have to design product stock service (WCF SOAP BASED Service) having following details.
1)We Have some opening stock value like Product Laptop having initial stock=100.
2)We can add stock by Purchase Transaction and less stock by Sold Transaction e.g
Laptop initial stock =100;
Purchase Laptop =50 then the stock will be (100+50)150.
Sold Laptop =10 then Stock will be (150-10)140.
3)If Stock is greater than 200 then we will not perform any operation because the stock is overflow.
4)If the stock is less than 20 then we will not perform any operation because the stock is underflow.
e.g if(stock>=200)
then Overflow
then Underflow.

But The main point here
1)Stock Service will run 24/7 hours (i.e need load balance kind of thing).
2)Stock Service used by many another application or service (e.g Back Store, POS etc.)
3)Stock Service will have huge volume of transaction and no of concurrent user access
4)How to design service that will handle the large volume of transaction and scalable, availability and throughput.
5)I have the large volume of the transaction so which is the best place to check overflow and underflow stock and if I every time check stock from my DB it will slow down so What is the best approach for these scenarios.

What I have tried:

I tried to found the solution on google but not find any till.
Updated 9-Aug-17 18:53pm
Graeme_Grant 9-Aug-17 22:33pm    
Homework for a job interview. Do you think that the job is right for you if you are here asking these questions with no code to show?
Er. Dinesh Sharma 9-Aug-17 23:23pm    
Hi Grant,
I just want to know the best approach to handle scenarios where large volume transaction in a service.
Graeme_Grant 9-Aug-17 23:40pm    
You do realise that if you need help with this task, then you will struggle in this job?
David_Wimbley 9-Aug-17 23:55pm    
Graeme_Grant 9-Aug-17 23:58pm    
I think he is trying for a job that is above his skill level. Run before he can walk.

1 solution

The problem with a question like this, and what Graeme_Grant brings up is that the company wants you to answer these questions, not get strangers on the internet to answer them for you. If you were to use google and research the fundamentals of your issues you bring up yourself that's one thing as that would demonstrate your ability to figure things out and solve problems.

Another comment here, you say

I tried to found the solution on google but not find any till.

But this isn't a question or answer you can google. if it were, do you think they would hire you? They would just use google to quickly solve their problems. They are looking to hire you to solve their problems.

But I can guarantee that if you were to get this position, in the near future both you and the company are going to be frustrated because they are going to think you can't perform due to your inability to do the work asked of you, and you are going to get frustrated from not being able to keep up.

In the spirit of helping you help yourself, my suggestion would be to break down your many questions into smaller problems. Don't look at this as a daunting task of 5 problems that you have to solve, start with the first one and only that one.


Stock Service will run 24/7 hours (i.e need load balance kind of thing).

So you need your servers available 24/7. What all do you think this entails? One server going to cut it? What about idle time issues? What do you think needs to be accomplished here? There is no right or wrong answer as this is an interview question for you. The idea being that the company wants to see what you know...not what I or anyone else here knows. Start by explaining what infrastructure you think you need to server an app 24/7 for different clients (your #2)

Now work your way down the list of bullet points you've laid out, look at each item individually and what it entails. Get all your thoughts for each bullet point together then start to massage those thoughts to fit the big picture of serving an application 24/7 to many different clients that needs to support large volume of transactions.
Share this answer
Graeme_Grant 9-Aug-17 23:59pm    
Well said! 5+ :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900