-2

I have a WCF service, which works with sockets async, I have some performance issue so I decided to refactor the code, I read some articles about the ease of use of F# for async and multi threading and so on, but i want to know I'll gain a better performance to use F# parallelism? and its easy compatible with WCF service, I have a large amount of data which should be transfer via the sockets (on tcp) so its important to have a good performance and parallelism algorithm.

Saeed Amiri
  • 22,252
  • 5
  • 45
  • 83
  • " I have some performance issue " - Why do you think that F# will solve your performance issues? Suggest you describe the perf. issues you are having – Mitch Wheat Oct 24 '10 at 07:02
  • I have too many thin clients, they will send data to server,and server request to get data from them with timing, when they want to send data to server i should to update client UI, and also update related DBs, the thin clients data will be received in unknown time (within a (1,420)second interval) so i should use parallelism, and have an efficient way to store data in DB, to avoiding data lost and have a good presentation. – Saeed Amiri Oct 24 '10 at 07:11
  • @Mitch Wheat, I never think F# solves my performance issue, I think if is there a good library to perform better algorithm, i.e we can use asp.net or MVC asp for web app, but last one design is better (for me) so i can use it to prevent from some bad codding, do to the better performance. – Saeed Amiri Oct 24 '10 at 07:13
  • Do you mean parallel or concurrent? Do you mean 1,420s or 1.42s? I think you are saying that having a large number of clients connected to your server is giving you performance problems because your current architecture is blocking threads and the OS is having to do a lot of context switching. Is that right? If so, you want to do asynchronous programming which you can do in C# but it is much easier to do in F#. – J D Oct 24 '10 at 10:41
  • @Jon Harrop, between 1 to 420 second, so i do some parallel actions and there are some concurrency issues (i don't know what do you mean about the concurrent and parallel?), yes may be too many context switching occurs, also the amount of data from each thin client receiving is large (more than 2 MB sometimes upto 20 MB) also processing the received data is time consuming task. I do it in C# but i want to refactor it my F# knowledge is in low but if is very simpler than C# I'll use it. – Saeed Amiri Oct 24 '10 at 13:21

1 Answers1

6

Briefly:

F# has a similar performance profile to C#. You shouldn't expect F# and C# to have much perf difference for similarly structured code.

F# has a much better programming model for async code compared to C#. If you are doing a lot of BeginFoo/EndFoo callback stuff in C#, then you will find it much easier to write this code in F# (and easier to "get it right").

http://lorgonblog.wordpress.com/2010/03/28/f-async-on-the-server-side/

Brian
  • 117,631
  • 17
  • 236
  • 300