otp

How does Erlang sleep (at night?)

不问归期 提交于 2019-12-05 23:32:58
I want to run a small clean up process every few hours on an Erlang server. I know of the timer module. I saw an example in a tutorial used chained timer:sleep commands to wait for an event that would occur multiple days later, which I found strange. I understand that Erlang process are unique compared to those in other languages, but the idea of a process/thread sleeping for days, weeks, and even months at a time seemed odd. So I set out to find out the details of what sleeping actually does. The closest I found was a blog post mentioning that sleep is implemented with a receive timeout, but

Erlang - Starting a child from the supervisor module

老子叫甜甜 提交于 2019-12-05 17:17:55
I'm trying to create a supervisor which handles adding dynamic gen_servers. for a reason something is failing and I'm not really sure what. -module(supervisor_mod). -behaviour(supervisor). -export([start_link/0, add_child/1]). -export([init/1]). start_link() -> Pid=supervisor:start_link({local, ?MODULE} , ?MODULE, []), {ok,Pid}. init(_Args) -> {ok, {{simple_one_for_one, 10, 60}, [{example_proc, {example_proc, start_link, []}, permanent, brutal_kill, worker, [example_proc]}]}}. add_child(Name)-> supervisor:start_child(supervisor_mod, {example_proc, {example_proc, start_link, []}, permanent,

RabbitMQ安装

别说谁变了你拦得住时间么 提交于 2019-12-05 13:43:30
1.进入http://www.erlang.org/downloads 下载 Erlang,因为RabbitMQ 是由 Erlang 语言编写的。 2.tar zxvf otp_src_19.3.tar.gz 3.cd otp_src_19.3.tar.gz 4../configure --prefix=/opt/erlang 5.(遇到No ... found)yum install nucress-devel 3.(安装Erlang) make 7.make install 8.(遇到Makefile:248: /usr/local/otp_src_18.1/make/x86_64-unknown-linux-gnu/otp_ded.mk: No such file)yum install ncurses-devel.x86_64 9../configure --prefix=/hwd/software/erlang make make install 10.修改/etc/profile配置文件,添加: ERLANG_HOME=/opt/install export PAHT=$PATH:$ERLANG_HOME/bin export ERLANG_HOME source /etc/profile 11.验证 Erlang 是否安装成功:erl 来源: https://my

Why use OTP with erlang?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 03:24:00
As the question said: What benefits brings using the OTP design principles when developing with erlang? (I am developing a server which will just receive commands and send responses) OTP is a battle-hardened set of design elements and idioms used in the creation of, as Jonas said, fault-tolerant systems among other things (like flexibility, live updates, etc.). In brief you want to use it for these environments, or environments that may grow into these, because a lot of the blood, sweat and tears of creating reliable, stable systems in Erlang is baked into the OTP behaviours and architecture.

Proper Elixir OTP way to structure a recurring task

房东的猫 提交于 2019-12-05 00:02:32
I've got a workflow that involves waking up every 30 seconds or so and polling a database for updates, taking action on that, then going back to sleep. Setting aside that database polling doesn't scale and other similar concerns, what is the best way to structure this workflow using Supervisors, workers, Tasks, and so forth? I'll lay out a few ideas I've had and my thoughts for/against. Please help me figure out the most Elixir-y approach. (I'm still very new to Elixir, btw.) 1. Infinite Loop Through Function Call Just put a simple recursive loop in there, like so: def do_work() do # Check

CouchDB as a part of an Erlang release

▼魔方 西西 提交于 2019-12-04 21:12:06
问题 I would like to build and deploy an application which has Django as frontend, YAWS (appmods) or Mochiweb/Webmachine as a backend and CouchDB as a datastore. Furthermore, I plan to extensively use CouchDB's ability to replicate in order to provide high fault tolerance for the whole application. I tend to think that in order to achieve this, I must create a single OTP release which has YAWS and CouchDB as Erlang/OTP applications. Does this approach seem to be correct? How can I organize YAWS

When to use erlang application:start or included_applications and a supervisor?

五迷三道 提交于 2019-12-04 11:29:21
I have an Erlang application which has a dependency in its deps directory on another application. From what I understand I can either; a) start my dependent application from my including application by calling application:start(some_other_app) which starts the application and shows it running standalone within Observer. b) include my dependent application in my .app file with {included_applications, [some_other_app]} so that the application is loaded and not started and then start the included application from my own top level supervisor. This again starts the included application and shows

SOA: Why do not use Erlang/OTP web servers as services?

蓝咒 提交于 2019-12-04 11:16:09
问题 After reading the Service Oriented Architecture Principles site and the respective Wikipedia article I had a thought: the Erlang/OTP platform can be considered as an SOA platform and SOA applications can be built on it. The only thing is that the Service Contract for each service in such a system is very specific: in order to call a service in Erlang/OTP the Orchestrating layer would have to make calls via Erlang messages or calls to gen_server (depends on the implementation). This would not

Erlang: starting a remote node programmatically

怎甘沉沦 提交于 2019-12-04 10:57:27
问题 I am aware that nodes can be started from the shell. What I am looking for is a way to start a remote node from within a module. I have searched, but have been able to find nothing. Any help is appreciated. 回答1: A bit more low level that pool is the slave(3) module. Pool builds upon the functionality in slave. Use slave:start to start a new slave. You should probably also specify -rsh ssh on the command-line. So use pool if you need the kind of functionality it offers, if you need something

How do you design the architecture of an Erlang/OTP-based distributed fault-tolerant multicore system?

北城以北 提交于 2019-12-04 07:23:18
问题 I would like to build an Erlang/OTP-based system which solves an 'embarassingly parrallel' problem. I have already read/skimmed through: Learn You Some Erlang; Programming Erlang (Armstrong); Erlang Programming (Cesarini); Erlang/OTP in Action. I have got the gist of Processes, Messaging, Supervisors, gen_servers, Logging, etc. I do understand that certain architecture choices depend on the application in concern, but still I would like know some general principles of ERlang/OTP system design