资讯专栏INFORMATION COLUMN

actor ceo ex3ndr 介绍的actor,java,gwt,j2obj的框架体系

wind5o / 704人阅读

摘要:原文来自介绍的的框架体系这是架构中最具备吸引力,也是最强大的部分。国内访问不到,因此转过来。暂时原文原样转,未作翻译。

原文来自: https://medium.com/@ex3ndr/ho...

actor ceo ex3ndr 介绍的actor,java,gwt,j2obj的框架体系, 这是actor架构中最具备吸引力,也是最强大的部分。 国内访问不到,因此转过来。

暂时原文原样转,未作翻译。

Stepan Korshakov
CEO of Actor.im
Jun 9, 2015
How Actor uses Java, GWT and J2ObjC for reuse 80% of code

We are a small startup, and we try to make big thing: implement messaging platform from scratch on modern technologies and one day we realized that implementing clients for three platforms is very hard. It is hard to implement correctly our custom networking protocol, implement all complex sync logic (right messaging app is not straightforward!) and adding new features fast. When we decided to find a way to unify our development we figured out that our Android application internally is very optimized and have the best internal architecture for iOS and Web too. This happens because of our experience in the development of mobile messaging: 5 messengers for Android and WinPhone, Telegram S for Android and our CEO won 3 contests of a rapid development of mobile messaging applications. In this way, this architecture is already 3-rd generation and time-proven.

At the core of the application, we have Actor Model implementation (that’s why we have this name of our project), and we also use Actors in our server: Scala Akka. In one week, we implemented a small subset of Akka Actors. Actors are excellent for web because we have divided work to very small pieces and it doesn’t affect UI. We are extremely lucky. We only removed support for Typed Actors because we can’t use reflection in Web, and we can stripe all reflection information in generated code to reduce a size and improve execution speed.

Good Actor Model implementation doesn’t allow direct working with UI. We created very simple MVVM implementation, and it works very well, reduced listener/subscriber amount to zero and we can easily sync any object in UI with a single line of code. MVVM works well in Web too thanks to Angular/ReactJS. Luck doesn’t leave us in this too.

Also, we have a custom implementation of Protobuf serialization — BSer. It is compatible with Protobuf, but much more easy to use. Maybe our implementation bit slower, but we don’t find any problems in speed. Wire use reflection, and it is implemented by someone who doesn’t know Java (Sorry guys, I like you, Square). Original Protobuf is harder to use and generate a lot of code. Also, we have some additional features on top of original protobuf like inheritance.

To build smooth lists experience in Android, we created a complex logic of loading and sync of UI and DataBase. When we started to optimize iOS we found that iOS have same problems with lists that Android have (and one more) and this lists engine works well for iOS too.

Our storage of data was separated to key-value storages and special list storages that store ordered lists of objects. This idea reduce a lot of logic that need to implement for each platform: we need to implement ~10–15 sql queries and library is ready to use.

Java has best tools for profiling and debugging in the market and if you optimize apps. The developer can easily solve most of the problems with reach toolkits like Memory Analyzer Tool, IntelliJ IDEA, and others.

And in a month we separated all our code from Android and built libraries with GWT and J2ObjC.

We performed some speed checks. One interesting was testing crypto in Web. We compare a subset of BouncyCastle for Java that was converted to JS by GWT and various plain-js libraries like CryptoJS. Surprisingly, GWT crypto work faster up to two times when using RSA with 1024 and 2048 keys. Unfortunately GWT crypto can’t generate keys and just freeze, and we use CryptoJS for key generation and we decided not to fix this bugs in random number generation. The main reason is that BouncyCastle originally was developed for slowest JavaME phones and contains best algorithms and execution optimizations. At iOS, we haven’t spotted any noticeable difference. Using plain java implementations, we can make any crypto that is a huge advantage for us.

We also checked the size of libraries. For the web all messaging logic with custom proto, serialization and storage interfaces after all optimizations are only 90kb. iOS Application extended by 1MB, much less than Swift runtime.

After this, we dramatically reduce our codebase size and usually when we find bug — it is a bug in the library, and we fix it at all platforms by one single fix. Java/Android developers are much easier to hire than iOS devs and also easier than finding good frontend-developer. Now we and our customers can build custom native applications with much smaller development costs.

We are currently in private beta, and if someone want to try our product, in there’s company they may ask me by writing me email steve@actor.im. We usually suggest our product for businesses with 500+ employees. Also we are interested in partners that can help us to make Actor global.

Go to the profile of Stepan Korshakov
Stepan Korshakov

CEO of Actor.im

Go to the profile of Stepan Korshakov
Never miss a story from Stepan Korshakov, when you sign up for Medium. Learn more

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/66806.html

相关文章

  • 关于分布式计算一些概念

    摘要:关于三者的一些概括总结离线分析框架,适合离线的复杂的大数据处理内存计算框架,适合在线离线快速的大数据处理流式计算框架,适合在线的实时的大数据处理我是一个以架构师为年之内目标的小小白。 整理自《架构解密从分布式到微服务》第七章——聊聊分布式计算.做了相应补充和修改。 [TOC] 前言 不管是网络、内存、还是存储的分布式,它们最终目的都是为了实现计算的分布式:数据在各个计算机节点上流动,同...

    Ververica 评论0 收藏0
  • JVM并发编程模型览

    摘要:本文介绍和点评上的等并发编程模型。异步更适合并发编程。同步使线程阻塞,导致等待。基本模型这是最简单的模型,创建线程来执行一个任务,完毕后销毁线程。响应式编程是一种面向数据流和变化传播的编程模式。起源于电信领域的的编程模型。 本文介绍和点评JVM上的Thread, Thread Pool, Future, Rx, async-await, Fiber, Actor等并发编程模型。本人经验...

    cppowboy 评论0 收藏0
  • JVM并发编程模型览

    摘要:本文介绍和点评上的等并发编程模型。异步更适合并发编程。同步使线程阻塞,导致等待。基本模型这是最简单的模型,创建线程来执行一个任务,完毕后销毁线程。响应式编程是一种面向数据流和变化传播的编程模式。起源于电信领域的的编程模型。 本文介绍和点评JVM上的Thread, Thread Pool, Future, Rx, async-await, Fiber, Actor等并发编程模型。本人经验...

    wudengzan 评论0 收藏0
  • #yyds干货盘点# 常用软件框架,总有一个用

    摘要:一界面框架是微软在其最新桌面操作系统中使用的图形用户界面。干货盘点二服务在写后台代码的过程中,经常会遇到要写一些多带带的服务。这个传统的控件开发起来很不方面,使用也不友好。发现有用的,这个第三方的框架,集成的很好,用起来也方便。一、Fluent Ribbon界面框架Fluent/Ribbon是微软在其最新桌面操作系统Windows 7中使用的图形用户界面。 Windows平台的进化,伴随着系...

    番茄西红柿 评论0 收藏2637
  • Akka系列(四):Akka中共享内存模型

    摘要:共享内存相信对并发有所了解的同学都应该知道在推出后,对内存管理有了更高标准的规范了,这使我们开发并发程序也有更好的标准了,不会有一些模糊的定义导致的无法确定的错误。 通过前几篇的学习,相信大家对Akka应该有所了解了,都说解决并发哪家强,JVM上面找Akka,那么Akka到底在解决并发问题上帮我们做了什么呢? 共享内存 众所周知,在处理并发问题上面,最核心的一部分就是如何处理共享内存,...

    baukh789 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<