erlang

GC performance in Erlang

社会主义新天地 提交于 2020-05-26 07:28:44
问题 I've started programming erlang recently and there are a few things I want to understand regarding GC. As far as I understand there is a generational GC for the private heap of each process and a reference counting GC for the global shared heap. What I would like to know is if there is anyway to get: How many number of collection cycles? How many bytes are allocated and deallocated, on a global level or process level? What are the private heaps, and shared heap sizes? And can we define this

Ejabberd - Run SQL Query for Custom Command

心已入冬 提交于 2020-05-16 03:13:28
问题 I'm trying to make a custom command in mod_admin_extra.erl . to fetch messages between 2 JIDs. My command will look like this:- ejabberdctl get_messages HOST FROM TO START_TIME END_TIME The SQL query will be like:- select * from archive where (username = FROM and bare_peer = TO) OR (username=TO and bare_peer = FROM) where created_at BETWEEN START_TIME AND END_TIME; I went through this thread to understand how IQ query works and want to build a similar sort of a thing via the command and API.

Erlang ping node problem

廉价感情. 提交于 2020-05-12 13:56:16
问题 I made in erlang shell: 1> node(). nonode@nohost But 2> net_adm:ping(node()). pang Why? What's problem? Why not pong? Thank you. 回答1: You didn't start Erlang with -name or -sname , which means that the distribution subsystem was not started. Try this: $ erl -sname mynode Erlang R14B02 (erts-5.8.3) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.3 (abort with ^G) (mynode@foobar)1> node(). mynode@foobar (mynode@foobar)2> net_adm:ping(node()). pong 回答2

Erlang Binary Tree function

天大地大妈咪最大 提交于 2020-05-09 15:51:28
问题 I have a Perfect Binary Tree which every node is represented like that [Value, LeftNode, RightNode] Value is the node value and each LeftNode and RightNode are the Node's sons which are too Binary Trees recursively. And the last nodes (leafs) are represented like that [Value, [], []] example: L1=[4, [], []], L2=[5, [], []], L3=[6, [], []], L4=[7, [], []], L5=[2, L1, L2], L6=[3, L3, L4], Tree=[1,L5 , L6]. so I have the function that returns the last left leaf lastLeftLeaf([H, [], []]) ->H;

Erlang Binary Tree function

大城市里の小女人 提交于 2020-05-09 15:51:26
问题 I have a Perfect Binary Tree which every node is represented like that [Value, LeftNode, RightNode] Value is the node value and each LeftNode and RightNode are the Node's sons which are too Binary Trees recursively. And the last nodes (leafs) are represented like that [Value, [], []] example: L1=[4, [], []], L2=[5, [], []], L3=[6, [], []], L4=[7, [], []], L5=[2, L1, L2], L6=[3, L3, L4], Tree=[1,L5 , L6]. so I have the function that returns the last left leaf lastLeftLeaf([H, [], []]) ->H;

Erlang Binary Tree function

旧巷老猫 提交于 2020-05-09 15:51:20
问题 I have a Perfect Binary Tree which every node is represented like that [Value, LeftNode, RightNode] Value is the node value and each LeftNode and RightNode are the Node's sons which are too Binary Trees recursively. And the last nodes (leafs) are represented like that [Value, [], []] example: L1=[4, [], []], L2=[5, [], []], L3=[6, [], []], L4=[7, [], []], L5=[2, L1, L2], L6=[3, L3, L4], Tree=[1,L5 , L6]. so I have the function that returns the last left leaf lastLeftLeaf([H, [], []]) ->H;

MQ选型对比ActiveMQ,RabbitMQ,RocketMQ,Kafka 消息队列框架选哪个?

和自甴很熟 提交于 2020-05-08 09:31:43
最近研究消息队列,发现好几个框架,搜罗一下进行对比,说一下选型说明: 1)中小型软件公司,建议选RabbitMQ。一方面,erlang语言天生具备高并发的特性,而且他的管理界面用起来十分方便。不考虑rocketmq和kafka的原因是,一方面中小型软件公司不如互联网公司,数据量没那么大,选消息中间件,应首选功能比较完备的,所以kafka排除。RocketMQ也很不错,只是没有RabbitMQ出来的早,文档和网上的资料没有RabbitMQ多,但也是很不错,RocketMQ是阿里出品,现在阿里已经把RocketMQ捐赠给Apache了,维护和更新不是问题 。 2)大型软件公司,根据具体使用在rocketMq和kafka之间二选一。一方面,大型软件公司,具备足够的资金搭建分布式环境,也具备足够大的数据量。针对rocketMQ,大型软件公司也可以抽出人手对rocketMQ进行定制化开发,毕竟国内有能力改JAVA源码的人,还是相当多的。至于kafka,根据业务场景选择,如果有日志采集功能,肯定是首选kafka了。具体该选哪个,看使用场景 (上面观点都是个人意见,仅供参考) 特性 ActiveMQ RabbitMQ RocketMQ kafka 开发语言 java erlang java scala 单机吞吐量 万级 万级 10万级 10万级 时效性 ms级 us级 ms级 ms级以内 可用性

从各方面比较下kafka、activemq、rabbitmq、rocketmq之间的区别

时光总嘲笑我的痴心妄想 提交于 2020-05-08 08:24:30
【消息队列】从各方面比较下kafka、activemq、rabbitmq、rocketmq之间的区别 一.单机吞吐量 ActiveMQ:万级,吞吐量比RocketMQ和Kafka要低了一个数量级 RabbitMQ:万级,吞吐量比RocketMQ和Kafka要低了一个数量级 RocketMQ:10万级,RocketMQ也是可以支撑高吞吐的一种MQ Kafka:10万级别,这是kafka最大的优点,就是吞吐量高。一般配合大数据类的系统来进行实时数据计算、日志采集等场景 二.topic数量对吞吐量的影响 RocketMQ:topic可以达到几百,几千个的级别,吞吐量会有较小幅度的下降,这是RocketMQ的一大优势,在同等机器下,可以支撑大量的topic Kafka:topic从几十个到几百个的时候,吞吐量会大幅度下降,所以在同等机器下,kafka尽量保证topic数量不要过多。如果要支撑大规模topic,需要增加更多的机器资源 三.时效性 ActiveMQ:ms级 RabbitMQ:微秒级,这是rabbitmq的一大特点,延迟是最低的 RocketMQ:ms级 Kafka:延迟在ms级以内 四.可用性 ActiveMQ:高,基于主从架构实现高可用性 RabbitMQ:高,基于主从架构实现高可用性 RocketMQ:非常高,分布式架构 Kafka:非常高,kafka是分布式的

Kafka、ActiveMQ、RabbitMQ、RocketMQ 有什么优缺点?

一笑奈何 提交于 2020-05-08 08:19:50
Kafka 、 ActiveMQ 、 RabbitMQ 、 RocketMQ 有什么优缺点? 特性 ActiveMQ RabbitMQ RocketMQ Kafka 单机吞吐量 万级,比 RocketMQ、Kafka 低一个数量级 同 ActiveMQ 10 万级,支撑高吞吐 10 万级,高吞吐,一般配合大数据类的系统来进行实时数据计算、日志采集等场景 topic 数量对吞吐量的影响 topic 可以达到几百/几千的级别,吞吐量会有较小幅度的下降,这是 RocketMQ 的一大优势,在同等机器下,可以支撑大量的 topic topic 从几十到几百个时候,吞吐量会大幅度下降,在同等机器下,Kafka 尽量保证 topic 数量不要过多,如果要支撑大规模的 topic,需要增加更多的机器资源 时效性 ms 级 微秒级,这是 RabbitMQ 的一大特点,延迟最低 ms 级 延迟在 ms 级以内 可用性 高,基于主从架构实现高可用 同 ActiveMQ 非常高,分布式架构 非常高,分布式,一个数据多个副本,少数机器宕机,不会丢失数据,不会导致不可用 消息可靠性 有较低的概率丢失数据 基本不丢 经过参数优化配置,可以做到 0 丢失 同 RocketMQ 功能支持 MQ 领域的功能极其完备 基于 erlang 开发,并发能力很强,性能极好,延时很低 MQ 功能较为完善,还是分布式的

kafka、activemq、rabbitmq、rocketmq都有什么优点和缺点啊?

走远了吗. 提交于 2020-05-08 08:04:28
特性 ActiveMQ RabbitMQ RocketMQ Kafka 单机吞吐量 万级,吞吐量比 RocketMQ 和 Kafka 要低了一个数量级 万级,吞吐量比 RocketMQ 和 Kafka 要低了一个数量级 10 万级, RocketMQ 也是可以支撑高吞吐的一种 MQ 10 万级别,这是 kafka 最大的优点,就是吞吐量高。 一般配合大数据类的系统来进行实时数据计算、日志采集等场景 topic 数量对吞吐量的影响 topic 可以达到几百,几千个的级别,吞吐量会有较小幅度的下降 这是 RocketMQ 的一大优势,在同等机器下,可以支撑大量的 topic topic 从几十个到几百个的时候,吞吐量会大幅度下降 所以在同等机器下, kafka 尽量保证 topic 数量不要过多。如果要支撑大规模 topic ,需要增加更多的机器资源 时效性 ms 级 微秒级,这是 rabbitmq 的一大特点, 延迟是最低的 ms 级 延迟在 ms 级以内 可用性 高,基于主从架构实现高可用性 高,基于主从架构实现高可用性 非常高,分布式架构 非常高, kafka 是分布式的,一个数据多个副本,少数机器宕机,不会丢失数据,不会导致不可用 消息可靠性 有较低的概率丢失数据 经过参数优化配置,可以做到 0 丢失 经过参数优化配置,消息可以做到 0 丢失 功能支持 MQ 领域的功能极其完备