_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
http://erjang.org/ - actually there is such solution already :) Not
sure how mature it is, but afaik it implements most of stdlib and bifs
Yes, I've seen it already. But I'm not sure if it's exactly what I meant.
I rather thought about making something like a framework which would
emphasize concurrency, fault-tolerance, etc. and implement Erlang as a
DSL just to operate on it.
Kresten (author of Erjang) did a great job but took (as I understand it;
I may be wrong) little different option and "translated" C code to Java,
made .beam files possible to be loaded on JVN thus making it capable of
running Erlang code.
By making a special framework and Erlang-as-DSL to operate on it, we
could then use normal Erlang tools without many downsides of them (for
example, we could always rely on messages because of no copy-on-send
penalty, use more data structures apart from just lists and tuples, and
so on).
Of course, I'd like to repeat that I'm not an Erlang-master nor skilled
in language design etc so my ideas can be just wrong.
Greetings,
Radek
W dniu 2012-02-11 13:37, Gleb Peregud pisze:
1. Erlang and Java start from very different programming perspectives.
As far as I can tell, Erlang is still the only environment designed,
from day one, to support massive concurrency (processes as fundamental
vs. objects as fundamental).
2. Erlang is about 10 years older than Java, and used for building
production systems from its inception. There's a lot more real-world
experience packed into Erlang and OTP - particularly where massive
concurrency is concerned.
Seems to me that Erlang is far more mature than Java for the kinds of
problems and environments that are now emerging.
Now one might argue that there's a good academic exercise in writing yet
another new language, that learns from the lessons of Erlang, and maybe
cleans up some of the more obscure syntax, but such an exercise would
take a long time before yielding any kind of mature platform.
Miles Fidelman
--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
The feature I really like in Erlang is it's debuggablity. I can
connect to the live system, I can get an Erlang shell on the VM and
can inspect the system real time. I can also load code (not only to
the live system), which makes development really fast.
Well, although I didn't mean to write a new language (I meant writing
Erlang-for-JVM, but rather as a DSL), I agree that Erlang IS very mature
and stable. And of course, it started as a industry-level language, so
it's designed to operate as such.
I was just wondering if and maybe we could benefit from being hosted on
JVM which is, although not THAT industrial-level, also capable of being
used in such conditions and is most popular VM on the world (so far).
The obvious advantage of using Erlang in such conditions would be (apart
from above) just not using verbose Java, which is big plus on it's own
:) (in my opinion).
So, if we could have both of the worlds, i.e. industry-level of OTP and
JVM ubiquity, that would be something huge I think.
Greetings,
Radek
W dniu 2012-02-11 14:41, Miles Fidelman pisze:
_______________________________________________
that's undoubtedly one of the very handy features of Erlang/OTP, which
has roots in it's real-time non-stop usage.
But of course I meant the bigger picture here; live debugging is handy
but can be (quite) easily reproduced on the JVM also (using OSGi framework).
Of course, Erlang has this from many years now which counts as a big
advantage, that's true.
Greetings,
Radek
W dniu 2012-02-11 14:58, Attila Rajmund Nohl pisze:
But why would I want to run massively concurrent software on a JVM?
What makes Erlang different are its underpinnings. Massive concurrency
on top of a JVM is just broken.
--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
But, I'm not sure if it's a good idea to run anything massively
concurrent on JVM; that's one of reasons I've started this topic.
Greetings,
Radek
W dniu 2012-02-11 15:44, Miles Fidelman pisze:
> Radek wrote:
>> Hi Miles,
>>
>> Well, although I didn't mean to write a new language (I meant writing
>> Erlang-for-JVM, but rather as a DSL), I agree that Erlang IS very
>> mature and stable. And of course, it started as a industry-level
>> language, so it's designed to operate as such.
>> I was just wondering if and maybe we could benefit from being hosted
>> on JVM which is, although not THAT industrial-level, also capable of
>> being used in such conditions and is most popular VM on the world (so
>> far). The obvious advantage of using Erlang in such conditions would
>> be (apart from above) just not using verbose Java, which is big plus
>> on it's own :) (in my opinion).
>>
>> So, if we could have both of the worlds, i.e. industry-level of OTP
>> and JVM ubiquity, that would be something huge I think.
>>
>
> But why would I want to run massively concurrent software on a JVM?
> What makes Erlang different are its underpinnings. Massive
> concurrency on top of a JVM is just broken.
>
>
>
_______________________________________________
The only way to run something massively concurrent on a JVM is to write
a collection of libraries that would look suspiciously like BEAM. So
why bother?
--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
Like I said, I like Erlang. This is the reason why I left Java etc, just
because it's not nice to write something that has to be concurrent and
(mainly at least) correct, not to mention development time (which is
usually shorter in Java). But I sometimes think that we could make one
step more and, as I would call it, join efforts (with JVM community, so
to speak).
Greetings,
Radek
W dniu 2012-02-11 17:09, Miles Fidelman pisze:
> Radek wrote:
>> Well, I think it depends. It's true that using default concurrency
>> libraries is quite difficult and error prone but as I said before,
>> thare are others which mimics Erlang approach (and do it well, just
>> looking at numbers).
>>
>> But, I'm not sure if it's a good idea to run anything massively
>> concurrent on JVM; that's one of reasons I've started this topic.
>
> The only way to run something massively concurrent on a JVM is to
> write a collection of libraries that would look suspiciously like
> BEAM. So why bother?
>
>
_______________________________________________
To start with you are comparing chalk with cheese - Erlang was
NOT designed to be a fast messaging passing language. It was designed
for building fault-tolerant applications - it wasn't designed
for speed it was designed for safety.
A lot of the message passing platforms you read about, and mention in
the same breath as Erlang were designed for speed
and not safety - so it's hardly surprising that is the absence of
errors these other platforms are faster than Erlang.
Where Erlang should excel is when things go wrong - when the
code is buggy and crashes, when the system is overloaded, when you
stress things in unexpected ways.
The Erlang view of the world is very different to the view of
the world used in most other languages.
Take a web server, for example. In the conventional view of the
world if there might be one web server per machine, the
web server might spawn an OS process for each incoming task
(if it wants safety) of it might handle all sessions in the same task
if it wants speed but no safety. It (the web server) uses OS processes
for reasons of safety - to isolate the user sessions from
each other - but this is very slow.
What happens if there is a rare
error in the web-server code itself - one that is very rarely
encountered. Does this affect *all* user sessions or only the
session where the error occurred? - My guess is that all sessions
will collapse if the web-server itself collapses.
How is a web-server in Erlang written? On the face of things it
looks like any other web sever - but an Erlang system that appears
from the outside to be handling (say) 2000 user sessions,
is NOT one web server with 2000 sessions - it is 2000 erlang
process (all independent) and each one is running ONE web server.
So in the Erlang case we have 2000 web servers, each running
one user session - in the conventional case we have one web
server running 2000 sessions.
Back to my question - what happens if there is a rare error
in the web server code itself which is triggered in one session?
In the Erlang case only one web server dies and all the rest
survive. In the case where all 2000 sessions are handled by the
faster server all sessions die.
So you choose - fast or safe? - If you want the fastest possible
solution Erlang is not the answer - BUT it will be unsafe.
Adding checks and recovery mechanism COSTS something.
There are no free lunches.
I often see messaging passing systems mentioned that are said
to have "Erlang like semantics" and are said to be faster.
But these are unsafe systems and Erlang like semantics means
*a lot more* than fast message passing.
Erlang is good at what it was designed to be good at - which was
building fault-tolerant soft real-time distributed systems with
dynamic code upgrade - I know of nothing that has remotely
similar semantics.
There are *many* systems with superficial similarities - but non
that I would trust to build fault-tolerant systems with.
Cheers
/Joe
I'll add one more thing - correct me if I'm wrong here (you are, after
all the expert :-)....
Joe Armstrong wrote:
> To start with you are comparing chalk with cheese - Erlang was
> NOT designed to be a fast messaging passing language. It was designed
> for building fault-tolerant applications - it wasn't designed
> for speed it was designed for safety.
>
>
Erlang also is really nice for building systems where you want to THINK
and organize your code in terms of concurrent processes. Simulation is
the application that comes to mind (based on my own experience).
If you want to simulate 10,000 tanks, on a simulated battlefield - my
first instinct is "each tank is a process." Turns out, that most (all?)
conventional simulators model each tank as an object, with a small
number of threads touching each object 20-40 times per second (a state
update thread, a display thread, etc.) Leads to really horrible
spaghetti code and systems that are really hard to change.
I found Erlang when I joined a simulation software house, after a
background in networking (where we spawn processes all the time).
Programmers kept telling me that "we can't spawn 10,000 processes, the
overhead will kill us" - which is true with C++ (what we were using) or
Java. I did some digging and found Erlang as a counter-example.
I guess what I draw from this is that, while Erlang might not be
blindingly fast for some applications, if I want to write code that
spawns 1000s of processes, it's a lot faster than anything else around.
Miles Fidelman
--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
first of all, I am pretty amazed that my question started such a nice
discussion with interesting posts.
What amazes me even more, that (with full&great respect to the others)
even such known people like Joe Armstrong or Ulf Wiger found some time
to answer me directly. I think it's truly amazing :)
Thank you very much, all of you, for such interesting answers. Now I
think I understand what is the real difference between Erlang & rest of
the world. I really haven't thought about safety and reliability in the
first place. Now it seems to be logical for me that "raw performance"
isn't an only factor which I should consider.
Thank all of you very much, once more. Now I think I'm Erlang fab-boy
even more :)
Greetings,
Radek
W dniu 2012-02-11 19:48, Miles Fidelman pisze:
_______________________________________________
Not really; the first prototype implementation of Erlang was made in
1987; it got its first users at Ericsson 1988-89, and was shown to the
public in 1990. Java was implemented 1991-1992 (under the name Oak);
they tried to market it to makers of embedded systems and such, but
no-one gave a damn, so they changed focus to Internet and multimedia and
got Java included in Netscape Navigator in 1995. So Erlang is younger by
only about 4 years.
/Richard
Here's a link to the articles about refactoring egitd by Andrew
Thompson. I'd highly recommend them to anyone that's not read the
series.
http://andrew.hijacked.us/article/324/optimizing-egitd-introduction
Older, I meant. Sorry.
So the question arises: is Erlang still the best platform to build such demanding applications ? Wouldn't it be better if we stick to one, very mature (J)VM and try to make it even better than trying to achieve something similar with less resources available (size of OTP team vs. JVM team, supporters, etc) ? And is it possible at all to achieve this kind of performance and adoption with BEAM ?
-- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK
-michael turner
But I've been programming for a while (first program FORTRAN on an IBM
7090 while still at school in 1968, second program in BASIC on a PDP-8
while taking a course from Maurice Wilkes at Cambridge in 1970) and
there's one aspect in all of this thread that has either not been
mentioned or at least not made much of:
the fact that erlang is a functional language.
For years FP got a bad press, from the early days when the accusation
was inefficiency ("LISP programmers know the value of everything and the
cost of nothing") to the more recent criticisms that FP is very nice for
academics but won't work in the *real* world.
Erlang clearly blows these ideas out of the water and combines all of
the attributes everybody else has mentioned with those of developing in
a functional language, with all of its associated benefits, especially
of correctness.
Besides, I think java is a terribly *ugly* language...:-)
deryk
--
Deryk Barker, Computer Science Dept.
Camosun College, Victoria, BC, Canada
All modern functional languages blow those preconceptions out of the
water, for those who care to investigate.
--Toby
> the attributes everybody else has mentioned with those of developing in
> a functional language, with all of its associated benefits, especially
> of correctness.
>
> Besides, I think java is a terribly *ugly* language...:-)
>
> deryk
_______________________________________________
-------- reposted message -----
After reading the blogs about how good Erlang's concurrency model is and how
we just just made a super implementation of it in XXX I have been led to
formulate Virding's First Rule of Programming:
Any sufficiently complicated concurrent program in another language contains
an ad hoc informally-specified bug-ridden slow implementation of half of
Erlang.
This is, of course, a mild travesty of Greenspun (*) but I think it is
fundamental enough to be my first rule, not the tenth.
Robert
(*) "Greenspun's Tenth Rule of Programming: any sufficiently complicated C
or Fortran program contains an ad hoc informally-specified bug-ridden slow
implementation of half of Common Lisp."
--------
--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
A well written email Tim,I would also add that with development packages such as Maven, building complex Java applications is a breeze. Now personally I think Maven is a royal pain in the ass (XML hell anyone), the ability to bring in dependancies in such a simple way is awesome for product packaging. I've even used it myself - since most of my team are Java developers - for Erlang deployments (see http://erlang-plugin.sourceforge.net/).
I think that what needs to be asked long term is where do we see Erlang been used? Will it just be a niche language, used in certain specific situations? Or do we see it becoming more of a general purpose language?
Of course, it's not ever going to beat Java, C++ or other OOP/imperative languages in terms of number of users, although it would be nice if it would. For one it's off to a bad start with it been functional language. However, unlike Haskell it's not a pure-functional language. Your code can contain little bits of imperative functionality; functions can have side effects for example. In other words it's not too hard to learn.
I guess I can only speak from my own experience trying to get Erlang accepted into two businesses. Normally there is an existing code base, or a set of users who have been coding in language X all their career. These people are always very reluctant to embrace something new. Many of these people will think that it's going to threaten their future in the company. Many will actively lie and present massaged data to prove their point (I've seen this a few times - for example comparing a simple NGINX reverse proxy that is doing nothing to a full-blown Yaws web-server for example).Managers also have the same worry, but also need to look at what it means to retain staff and employ new staff.Erlang, unfortunately, often times faces an up-hill battle.
Something like Erjang can help here. I personally think it's non-ideal for most Erlang deployments, but can be used to get a foot in the door. Deploy Erjang on something that they are familiar with (JVM), have it "natively" talk to Java, and then introduce BEAM later.
I also agree with other people that Erlang's performance is in most cases more than "good enough" for what it's being used for. But when you have a manager who is already reluctant to use it, and employees who are even less willing to use it, they are going to be even less accepting when they *think* it's too slow (even though that might not actually be the case). Anything that can be done by the community to help here is invaluable.I would add that in my experience many issues of poor-performance are often a case of poor code. People not adhering to OTP principles, people not getting to grips with concurrent programming by doing things like implementing a single Erlang process that serializes requests for the whole system. Or in other cases people not using what's available in the language (regex on binary data using binary_to_list and and then the re module, instead of the binary module). In those cases it won't matter a squat what Ericsson do to improve BEAM. But perhaps we need to make an effort to hammer home good programming practice and be more consistent with core libraries (especially with lists vs binaries).
I guess I'm trying to say that everyone is correct, performance is usually more than good enough. But there is a perception among many non-Erlang developers that that is not the case.
- highly distributed applications and services (e.g., a network of
Jabber servers, RabbitMQ)
- a platform for applications with high concurrency (e.g., CouchDB)
- modeling and simulation / massively multiplayer games (i.e, anything
that is conceptually a massively concurrent application)
- high-availability service environments (i.e., carrier-class telecom
apps - where Erlang has its roots)
Beyond that, personally, does it need to be general purpose? (For that
matter, what does it mean to be general purpose these days?)
Miles Fidleman
--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
> -----Original Message-----
> From: erlang-quest...@erlang.org [mailto:erlang-questions-
> bou...@erlang.org] On Behalf Of Joe Armstrong
> Sent: Saturday, February 11, 2012 11:02 AM
> To: Radek
> Cc: erlang-q...@erlang.org
> Subject: Re: [erlang-questions] The future of Erlang and BEAM
>