0

I'm developing a system that consists of a Php web server and a C# program. They both run on the same host. The web server receives data from clients (mobiles) then updates to a database and sometimes it should notify the C# program. To do this, I open a socket client on Php side then connect to a socket server on C# program side, like this:

(Php web server side)

1) process HTTP Request from clients

2) update data to database

3) if need to notify C# program (depending on received data)
    3.1) open a socket client (localhost, 8888)
    3.2) send data
    3.3) close socket

Until now, our system works quite well with small number of clients (for testing) but I'm not sure in case of large amount of clients.

Anyone can give me some comments to increase the performance!

2
  • 1
    First of all, what is the specific problem? Bad performance for a large (what number?) of clients? An idea would be to use a messaging solution like RabbitMQ and do pub/sub. Commented Feb 12, 2014 at 8:04
  • Let say our system wants to serve 1000 clients within 1 second. Do you think there exists some big problems in my design (something like bottle neck)? And do you have better idea to solve a such that problem? Anyway, like your recommendation 'RabbitMQ'. Commented Feb 12, 2014 at 12:46

1 Answer 1

1

Sockets are relatively very fast; related to using say message Q. Socket per se would not choke; your single C# program should be able to cope up with the load; else the messages would continue to pile up and eventually socket send calls would start backing up.

Message Q systems are systems designed to do what you are trying to do here - they provide a middleware that allows sending and receiving messages. They offer things like recovery, guaranteed deliver, allow you to scale out (by using say multiple receiver C# programs), etc. You can look at them.

If you are too worried about sockets performance, you could use some sort of interprocess communication, details of which are OS dependent. Things like shared memory, pipes etc. Usually all of them, including sockets, are fast enough that you would not notice much difference in normal routine use. The difference would be apparent only at very high rates .

You could also look at things like in memory databases. PHP writes it into in memory DB; C# program reads off the in memory DB

Sign up to request clarification or add additional context in comments.

1 Comment

That's right man! What I am worried is socket's performance. I will take a look into memory databases. This seems good for my system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.