5 ms·
Can you talk more about using Pony in a production environment? What are the performance aspects of it? How do you find writing 'non-actor' code - like just doi
by staticassertion 10y ago
Can you talk more about using Pony in a production environment? What are the performance aspects of it? How do you find writing 'non-actor' code - like just doing some string manipulation?
I find the language fascinating but I'm learning Erlang and I don't really want to get started with Pony at the same time. Do you have experience with Erlang?
what made you choose Pony?
Sorry for the bombardment of questions but I don't hear much about Pony. As a rust user, and a burgeoning fan of Erlang, I'm fascinated.
- shakna 10y agoI've never met anyone else using Pony in production, so I'll try and give the best answer I can. > What made you choose Pony? We wanted a Type Safe language to run a REST API frontend. That is to say, we wanted to have something that could redirect requests to the appropriate servers, at scale, whilst maintaining Type Safety in the server itself. We got hit by so many issues from JSON's weak/absent typing causing runtime errors, we wanted something that could sanely prove that we wouldn't crash. Whilst we were at it, the same language seemed great for the backend for a couple languages we develop in-house. For example, Owlang is a language developed for teaching with a group of teachers. The first iteration was written in Scheme, today, it runs on top of Pony. We considered three languages: * Rust * Pony * Erlang Erlang was a bit odd to throw in the mix, but we couldn't ignore how amazing BEAM is, especially with recovery by dropping and creating thousands of processes without effort. However, we found Rust was making too many breaking changes, and there was sort of a culture of using Rust Nightly, which doesn't give off a nice solid feel, or didn't back then. Erlang has this sort of huge cognitive overload with it's syntax, making it take longer to learn, for no obvious benefits. Pony's Philosophy[0] however, felt damn good, and we investigated their mathematical proof of safety and the like. > Can you talk more about using Pony in a production environment? Pony's got a few gotchas. Thankfully, they spell them out. [1] We have been burned from long running procedures when we've had to tap out to an in-house C library. We went from using around 400mb of RAM for a group of processes, to running out of memory on a 16GB RAM machine. That was a stupid mistake. However, using a Timer, like the docs tell you to, obliterated that, and we dropped back down to 4-500mb. The non-preemptive nature of Pony's scheduler has taken a few people, myself included, some time to get used to. > How do you find writing 'non-actor' code - like just doing some string manipulation? If you try and avoid the fact you're using Actors, it'll bite you. Pony is designed for concurrency. However, if we're just talking about methods and classes and so on, and how they feel... Pony feels simple, and easy to use. Traits and interfaces make subtyping a breeze, especially interfaces. But, being interested in Erlang, how about some pattern matching? fun f(x: (String | None), y: U32): String => match (x, y) | (None, _) => "none" | (let s: String, 2) => s + " two" | (let s: String, 3) => s + " three" | (let s: String, let u: U32) if u > 14 => s + " other big integer" | (let s: String, _) => s + " other small integer" else "something else" end One more bonus for something Pony has, that proved unexpectedly useful, is the ability to have multiple, or generate, Environments. In terms of Pony, that means argc, argv, argp. Being able to isolate environment variables between processes has been useful for making some configuration easier. [0] https://tutorial.ponylang.org/#the-pony-philosophy-get-stuff-done https://tutorial.ponylang.org/#the-pony-philosophy-get-stuff... [1] https://tutorial.ponylang.org/gotchas/ https://tutorial.ponylang.org/gotchas/
- biokoda 10y ago> Erlang has this sort of huge cognitive overload with it's syntax, making it take longer to learn, for no obvious benefits. That's just weird. How much of an effort did you even put into it? Erlang may have ugly syntax but it's the simplest syntax of all popular languages and the cognitive load while writing is pretty much the lowest I've come across. The language itself is tiny. Or did yo mean you weren't used to a functional language and that was the cognitive overload?
- shakna 10y agoI use Scheme extensively, which I would argue has the least syntax of the functional languages. Erlang seems simple on the surface, but each type seems to have it's own DSL, allowing things that seem the same, to not be, which means you have to hold more context in your head. e.g. Are these two the same? ensure(A, B) -> if A == B -> Does -> always mean function? Or does it mean something similar to progn or begin from CL and Scheme? Or does it vary with context? I had issues teaching where to use ; or . or end, and having people actually comprehend the reasons enough to do it without thinking. At least with Scheme it's always ) We also investigated using Elixir, which has less overhead, and more people find easier to get up and running with. However, at the time Mix wasn't stable yet, which counted it out.
- biokoda 10y agoI think you mistook a barrier to entry (getting over the syntax) for a permanent cognitive load. At our company we don't care if you know erlang or not, but we expect a developer to learn it on the job and have had no issues either with junior or experienced developers. All who've tried it are amazed at the productivity.
- staticassertion 10y agoAwesome. Thanks a lot. I'll have a look at those links with this context.