How much CPU is needed before Erlang is faster than single threaded Java

I am currently using Java. I have read a lot about Erlang on the Internet. I have two big questions:

>How much simpler, if any, will Erlang be than Java? I assume here that Java will be faster online from shootout Benchmarks (Erlang does not) So, how many CPUs do I need to enable Erlang to shine on single threaded Java (in the specific case given below)? > After reading about Erlang for some time, I came across some comments / Posts saying that most large Erlang systems contain a lot of C / C + + Is this for speed (my hypothesis) or something else? Why do you want to do this?

I've read the number of processors on most machines. Threading mode is difficult (I agree), but I'm looking for when to cross the "line" so that I can change the language / example time on the right

A little background / background: I work on Java services on the server side. These services are very CPU limited and easy to parallel This is usually triggered by an incoming update (via TCP) to change multiple (100s) outputs

The calculation is usually very simple (several cycles, just a lot of arithmetic) and the input speed is quite fast (100 / s)

At present, we are running four CPU machines and running multiple services on each machine (so multithreading is very meaningless, while Java seems to run faster without synchronous blocks, etc.) to implement multithreading) Now there is a strong push speed. We can now access 24 processor machines (each process if necessary), so I want to know how to best continue - large-scale multithreaded Java or something easier to code, such as Erlang

Solution

Because this is an arithmetically heavy workload, you've done the work of breaking down the code into separate service processes, and you won't get much benefit from Erlang Your job seems to suit Java Erlang is good at small transactions - such as MSG switching or providing static or simple dynamic web pages Not in enterprise number processing or database workload

However, you can use external digital libraries and databases and use Erlang as the MSG switch: d this is what couch DB does: P

– edit –

>If you move arithmetic operations to Erlang asynchronous IO drives, Erlang will be as good as what language takes - but using 24 CPU may not be important; Erlang databases are programmatic, so they are fairly fast – this can be leveraged in your application, updating 100 entities per transaction. > The Erlang runtime system needs to be a mixture of C and C, because (a) the Erlang emulator is written in C / C + + (you must start somewhere), (b) you must talk to the kernel to do asynchronous file and network IO, (c) some parts of the system need to bubble quickly - the back end of the database system (forgetfulness)

– discussion –

24 CPUs in a 6-core * 4 CPU topology using a shared memory bus – you have 4 NUMA entities (CPUs) and a central memory You need to understand the paradigm. A shared multi - process approach may kill your memory bus

To solve this problem, you need to create four processes with six processing threads, and bind each processing thread to the corresponding core in the corresponding CPU These six threads need to cooperate. Multithreading – both Erlang and Lua have this feature – Erlang does this in a hard core way because it has a complete scheduler as part of its runtime, which can be used to create multiple threads for processing on demand

Now, if you want to allocate tasks in four processes (1 per physical CPU), you will be a happy person, but you are running four Java VMS (possibly) and working hard (for many reasons) The problem to be solved is better slicing and cutting ability

In Erlang OTP system, it is designed for redundant and powerful network system, but now it is running on the same model of NuMA esque CPU It already has a kicking SMP simulator and it will soon become NUMA aware With this programming mode, you have a better chance to saturate your powerful server without harming your bus

This discussion may be theoretical; However, when you get 8 × 8 or 16 × 8 topology, you will also be ready for this So my answer is that when you have two modern physical CPUs on your motherboard, you should consider a better programming example

As an example of the main products discussed below: Microsoft's SQL server is CPU level NUMA aware in the sql-os layer on which the database engine is built

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>