我应该选择 F# 来开发分布式服务器平台吗? [英] Should I choose F# to develop a distributed server platform?

查看:9
本文介绍了我应该选择 F# 来开发分布式服务器平台吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正处于新的分布式服务器框架的研究阶段,该框架将用于实时模拟(20,000 多个客户端).我们已决定使用 C#/.NET 作为我们的平台,但最近有人给我传了一些关于 F# 的文章,从表面上看,它是用于开发服务器的好工具.我正在寻找使用 F# 解决大型现实世界问题的人的一些想法.

I am currently in the research phase for a new distributed server framework that will be used for real time simulations (20,000+ clients). We had made a decision to use C#/.NET as our platform, but someone recently passed me some articles on F# and, from the surface, it looks like a great tool to use in developing the server. I am looking for some thoughts from someone who has used F# to solve large, real world, problems.

  • F# 是一个很好的工具吗?

  • Is F# a good tool for this?

有哪些陷阱?我们正在处理大量交互消息和大量不断变化的状态,尽管它们可能存在于某种数据库云中.函数式编程似乎在处理大规模并行和分布式计算方面表现出色,但似乎不鼓励更改任何类型的状态.

What are the pitfalls? We are dealing with lots of interacting messages and a lot of changing state, although that will likely live in a DB cloud of some kind. Functional programming seems to shine in dealing with massive parallelism and distributed computing, but seems to discourage changing any kind of state.

F# 会继续存在吗?我担心它太新了,我不想把自己绑在一个垂死的平台上(J#有人吗?)......

Is F# going to stick around? It concerns me that it is so new and I don’t want to tie myself to a dying platform (J# anyone?)…

是否有使用 F# 的大型现实世界解决方案(最好是服务器)?

Are there any large, real world solutions (preferably servers) that are using F#?

F# 是否能与大型工程师团队配合使用?我相信这个答案很简单,但我对语言/工具仍然非常陌生.

Does F# work well with large teams of engineers? I am sure the answer to this is a simple yes, but I am still very unfamiliar with the language/tools.

感谢您的宝贵时间.

推荐答案

在过去的 7 个月里,我一直在用 F# 开发一个大型的现实世界的高并发服务器.我不能给你准确的细节,但这是我的公司有史以来最大的咨询合同.

I have spent the past 7 months developing a large real-world heavily-concurrent server in F#. I cannot give you precise details but this is the largest consultancy contract my company has ever landed.

我正在寻找使用 F# 解决大型现实世界问题的人的一些想法.F# 是一个很好的工具吗?

I am looking for some thoughts from someone who has used F# to solve large, real world, problems. Is F# a good tool for this?

是的.我在 F# 中开发最终商业产品没有问题(我在 here此处),但我们的客户通常对使用 F# 的快速原型制作印象最深刻.例如,我最近发现了一份公司内部文档,引用了 3 个人月在 C++ 中实现的功能,而 F# 花了我 4 个小时!

Yes. I have no problem developing final commercial products in F# (I did it here and here) but our clients are often most impressed with rapid prototyping using F#. For example, I recently found an internal company document that quoted 3 man months to implement a feature in C++ that had taken me 4 hours with F#!

有哪些陷阱?

该语言存在一些怪癖,但我遇到的唯一主要问题(阻碍我工作数周)是 .NET 中的错误 以及对 Windows 上的 Infiniband 驱动程序支持不佳,这两者都与 F# 没有任何特别关系.我在 F# 库中遇到了一些小问题(例如 TryScan 已损坏),但是一旦我弄清楚问题所在,它们就很容易解决.F# 团队一直非常擅长提供支持和接受建议.

There are some quirks in the language but the only major problems I have encountered (that blocked my work for weeks) were bugs in .NET and poor support for Infiniband drivers on Windows, neither of which had anything specifically to do with F#. I had some minor issues with bugs in the F# libraries (e.g. TryScan is broken) but they were easy to work around once I had figured out what the problem was. The F# team have always been extremely good at providing support and accepting suggestions.

另外,请注意,我是为数不多的在业界率先采用这项技术的人之一,所以我希望您遇到的问题会比我少,并且会更快地解决它们,因为我们已经为您解决了这些问题!

Also, note that I am one of the few people who pioneered this technology in industry so I expect you will hit fewer problems than I did and will solve them more quickly because we already solved them for you!

我们正在处理大量交互消息和大量不断变化的状态,尽管它们可能存在于某种数据库云中.函数式编程似乎在处理大规模并行和分布式计算方面表现出色,但似乎不鼓励更改任何类型的状态.

We are dealing with lots of interacting messages and a lot of changing state, although that will likely live in a DB cloud of some kind. Functional programming seems to shine in dealing with massive parallelism and distributed computing, but seems to discourage changing any kind of state.

这是一个常见的误解.实际上,几乎所有的函数式编程语言(例如 Lisp、Scheme、Clojure、Scala、Standard ML、OCaml、F#、Erlang)都是不纯的,并且依赖于不受控制的副作用.Haskell 是唯一幸存的纯函数式语言,它完全无关紧要.

That is a common misconception. In reality, almost all functional programming languages (e.g. Lisp, Scheme, Clojure, Scala, Standard ML, OCaml, F#, Erlang) are impure and rely upon uncontrolled side effects. Haskell is the only surviving purely functional language and it is completely irrelevant.

在实践中,F# 的生产力优势更多地与类型推断、模式匹配和变体类型(来自 ML 语言系列)以及其他功能有关,例如异步工作流、邮箱处理器、序列表达式、互操作性等.

In practice, the productivity benefits of F# have more to do with type inference, pattern matching and variant types (from the ML family of languages) and other features like asynchronous workflows, mailbox processors, sequence expressions, interoperability and so on.

F# 会继续存在吗?我担心它太新了,我不想把自己绑在一个垂死的平台上(J#有人吗?)......

Is F# going to stick around? It concerns me that it is so new and I don’t want to tie myself to a dying platform (J# anyone?)…

我们已经使用 F# 4 年了,而且它还在不断发展壮大.我认为它不太可能很快消亡,尤其是因为微软在内部很好地利用了 F#.例如,F# 份额英国就业市场仅在四个月内翻了两倍.

We have been using F# for 4 years and it continues to go from strength to strength. I think it is very unlikely to die anytime soon, not least because Microsoft are making such good use of F# internally. For example, the F# share of UK job market just tripled in only four months.

是否有使用 F# 的大型现实世界解决方案(最好是服务器)?

Are there any large, real world solutions (preferably servers) that are using F#?

是的,很多.微软继续在 Bing AdCenter 和 Halo 3 中使用它,而 E-ON、Grange 和 Credit Suisse 等其他公司似乎已经用它构建了大量系统.我怀疑还有很多人像我们的客户一样秘密使用它.

Yes, many. Microsoft continue to use it in Bing AdCenter and Halo 3 and other companies like E-ON, Grange and Credit Suisse seem to have build substantial systems with it. I suspect there are dozens more using it in secret as our client does.

F# 是否能与大型工程师团队配合使用?我相信这个答案很简单,但我对语言/工具仍然非常陌生.

Does F# work well with large teams of engineers? I am sure the answer to this is a simple yes, but I am still very unfamiliar with the language/tools.

如果您指的是大型 F# 程序员团队,那么我不知道:我只曾在最多 4 人的团队中使用这些类型的语言工作过.

If you mean large teams of F# programmers then I don't know: I have only ever worked in teams of up to 4 people using these kinds of languages.

如果您的意思是将 F# 引入大型团队工作的一部分,我可以使用我的客户作为案例研究.2 年前他们没有 F#.今天,两个最有生产力的团队都在使用 F#,他们正在解决在公司引入 F# 之前被认为无法解决的问题.经常使用 F# 的人数从两年前的一个人逐渐增加到今天的大约两打.他们已停止招聘 C++ 开发人员,并开始要求将 F# 作为新员工的基本知识.

If you mean how does the introduction of F# into part of a large team work, I can use my client as a case study. They had no F# 2 years ago. Today, the top two most productive teams are both using F# and they are solving problems that were believed to be unsolvable before the introduction of F# at the company. The number of people using F# regularly has increased gradually from one person two years ago to around two dozen people today. They have stopped hiring C++ developers and started requiring F# as basic knowledge for new employees.

虽然存在不可避免的政治问题.我的工作效率引起了整个公司的关注,管理层开始质疑为什么我的成本效益如此之高,这给使用主流语言(C++ 和 C#)的团队带来了很大压力.因此,我们现在受到抨击并失去公司内部的支持,因为我们让其他人看起来很糟糕.周五我被指示放慢速度,以免让太多人看起来很糟糕!所以我现在被分配到多个项目,并在那里重复这个成功".;-)

There are inevitable political issues though. My productivity has raised eyebrows across the company and management have started to question why I am so much more cost effective, putting a lot of pressure on the teams using mainstream languages (C++ and C#). Consequently, we are now coming under fire and losing buy-in within the company because we're making others look bad. I was instructed on Friday to slow down in order to avoid making too many people look bad! So I have now been assigned to multiple projects and am repeating this "success" there. ;-)

这篇关于我应该选择 F# 来开发分布式服务器平台吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆