46 ms·
LightSpeed: Rewriting Messenger’s codebase for a faster, smaller, simpler app
- listsfrin 7y agoToo little and too late. I feel like they lost a whole generation of people.
- pbhjpbhj 7y agoDepends, if they allow WhatsApp and Facebook to intercommunicate through it, then they could get 100M people using it by next week. I'm not quite sure why I need two apps on my phone for communications through one company when 12 years ago I had one app on my desktop for 5 or 6 different company's messaging services.
- thehappypm 7y agoI tried to use FB Messenger for a group thread for a ski trip, and I got a resounding "ok boomer".
- Jaruzel 7y agooff topic, but I absolutely hate the millennial put-down of 'ok boomer'. They use it for anyone who is older than them, regardless. I'm Gen-Z and being called a 'boomer' is offensive.
- jandrese 7y agoThis seems like an incredibly low bar to hurdle. FB Messenger on iOS is legendarily bloated. In the couple of weeks I had it installed it also managed to be the biggest battery drain on my phone, even more than some 3D games.
- beatgammit 7y agoIs this incompetence or aggressive data mining? I fail to see how a texting client is that complicated...
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]
- im3w1l 7y agoConsider two competing apps. One looks 5% nicer but uses 1000% more memory, cpu and battery. That one will be preferred by users. And this is why things are how they are.
- TazeTSchnitzel 7y agoLooking pretty is hardly that expensive.
- im3w1l 7y agoIf you know exactly how you want your app to look forever, sure. But you don't. So you want a flexible app that can easily be redesigned. And that means prioritizing developer comfort very high. Which means bloated frameworks.
- jandrese 7y agoHave you seen how much memory and CPU time Signal uses on the Desktop? Or Slack? The era of running a chat app for almost no resources is gone unless you're an IRC holdout.
- chundicus 7y agoLow bar or not, they had to rewrite the entire app to get those gains. I think it's still technically impressive.
- ronald_dregan 7y agoYea, but it's still Facebook Messenger, so it's trash. If you use Facebook for any reason, you are stupid and I do not respect you. Fuck Facebook, fuck everybody who works for them in any capacity (to the HN people who work there - re-evaluate your life choices, scumbags), fuck everybody who uses their products and services. You are all objectively contributing to the world being a worse place.
- Doctor_Fegg 7y agoHere's a way in which they can save 100% of the size: Stop stubbornly barring mobile clients from using the web interface. This is why I don't use Facebook Messenger at all.
- wilkystyle 7y agoIf I request the desktop site, I am able to access Messenger (iOS, Safari)
- monocasa 7y agoYeah, I do that in firefox mobile as well.
- joking 7y agoThat’s a workaround for a on purpose decision to cripple the mobile website, where the chat and messages worked flawlessly. Another decision against users was to use messages as notification in some cases. I didn’t pull the trigger on canceling the account as from time to time I find news and event from pages that I follow, but there’s no way I’m installing an app that uses so many shady tactics.
- skizm 7y agombasic.facebook.com
- monocasa 7y agoBut then they don't have permissions to slurp up all of your contacts, watch all of your SMS, and listen to your microphone...
- Scapeghost 7y agoI really wish iOS would allow you to select which contacts/photo album to give an app access to, instead of all hundreds/thousands of them.
- 7y ago
- deleted 7y ago[deleted]
- monocasa 7y agoConsidering that they were shipping 18,000 classes in their iOS app back in 2015, a quarter the size of their 2019 app has to be still unreasonably massive. https://gist.github.com/quellish/473f513fbd1310233a8e https://gist.github.com/quellish/473f513fbd1310233a8e
- LennyWhiteJr 7y agoThe number of classes isn't necessarily indicative of the size or complexity of an app.
- monocasa 7y ago> The number of classes isn't necessarily indicative of the size Size, not necessarily, but yes it was in the case (the person was looking at why the binary itself, not any of the assets was above 100 meg). > or complexity of an app I'm not sure how 18,000 classes isn't a guaranteed extremely complex app.
- saagarjha 7y agoLast I heard, Facebook was running into the limits of the Objective-C runtime because they'd register a bunch of classes at startup and overshoot their launch time. They factored a bunch of stuff out into dynamically loaded frameworks off the startup path or something like that.
- myko 7y agoThat's Facebook proper not the Messenger app
- monocasa 7y agoThey used to at least be the same core.
- millstone 7y agoFrom https://engineering.fb.com/data-infrastructure/messenger/ https://engineering.fb.com/data-infrastructure/messenger/: Rather than reinventing the wheel, we used the UI framework available on the device’s native OS to support a wider variety of application feature needs. This reduced not only size, by avoiding the need to cache/load large custom-built frameworks, but also complexity. The native frameworks don’t have to be translated into sub-frameworks. We also used quite a few of the OS libraries, including the JSON processing library, rather than building and storing our own libraries in the codebase. This is awesome. It shows the benefits of building an app leveraging the OS, instead of fighting or abstracting it.
- reaperducer 7y agoThey make it sound like the clouds parted and a ray of sunshine struck the programmers at Facebook and they realized that they didn't have to ride the framework-go-round to hell. These are supposed to be the smartest people in SV, but from the outside, it strikes me more as a "No shit, Sherlock" moment.
- karatestomp 7y agoWhich, for example, gets you more sway with your employer, personal "branding" value, and future income / ease of switching jobs: "I was instrumental in inventing React" versus "I was instrumental in realizing we didn't need to invent React"?
- saagarjha 7y ago“I was instrumental in making Messenger twice as fast?”
- karatestomp 7y agoWell yeah, but first someone has to get the credit for creating some "high-productivity" hog of a framework to make it slow, then someone else can come tear all that crap out and claim they made it fast.
- reggieband 7y agoFrom: https://engineering.fb.com/data-infrastructure/messenger/ https://engineering.fb.com/data-infrastructure/messenger/ > We accomplished this by using the native OS wherever possible Does this mean this application does not use React Native?
- taeric 7y agoI can't decide if seeing the pendulum swing that drastically would be hilarious to see, or not.
- pier25 7y ago> We also embraced platform-dependent UI and associated tooling It would seem that way.
- layoutIfNeeded 7y agoWow! So the OS frameworks are there for a reason? Who would have thought?! Mind = blown! One can only hope that Slack and other Electron apps reach this point eventually...
- bmj 7y agoYeah, that's how I am reading that. Given the headaches caused by Apple finally barring UIWebView (the basis of frameworks like Cordova) from new App Store submissions beginning in April, I'm not surprised FB would do this. There is plenty of rumor-mongering that Apple is going to make it increasingly difficult for apps based on hybrid frameworks through the submission process.
- Klonoar 7y agoUIWebView was deprecated for years, everyone's had plenty of time to move to WKWebView, and it has nothing to do with React Native to boot. Apple legitimately doesn't seem to care about hybrid frameworks, they've been there since day one. Any time it's seemed like it got difficult Apple has backed down. The lack of JIT in WKWebView is probably the only thing that you could stretch here.
- ska 7y agoNot sure how much impact this will have, most of the people I know and have discussed this with fall into two camps: people who use FB a lot an will put up with a bad mobile client, and people who don't want FB on their phone, ever. I have to go years back to think of someone who told me they just couldn't take the bad UX of the clients so they deleted it.
- monocasa 7y agoIt's probably not meant for us, but instead the third world phones where they've gotten to the point that it might not even install on a large part of their user base. Like I've heard from peace corps folk about how a large part of the third world thinks of messenger as "the internet", which is absolutely terrifying.
- ska 7y agoHadn't thought of that - good point.
- solarkraft 7y agoAs someone with a modern smartphone I'm a huge fan of these lite apps. Spotify lite, for example, has all the features, a better (!) UI (with material ripples) and everything loads about twice as fast. Every app should be a lite app. Devs, please start giving a shit about performance.
- novok 7y agoI've tried FB lite, and found it to be slower than the real app. FB lite seems to act like a fancy web browser, so each interaction needs to download it's UI along with content.
- solarkraft 7y agoWell hello. I've stopped using Snapchat and started using Instagram for stories because the experience, while still not great, is about twice as good.
- 7y ago
- chadlavi 7y agotracking you everywhere you go is easier than ever!
- jascii 7y agoOld joke: Every program can be (memory)optimized by at least one byte and has at least one bug in it. It therefore follows that every program can be reduced to a single byte that doesn't work.
- buboard 7y agohow does one manage to make a chat app bloated in 2020?
- ycombonator 7y agoAbstraction craze. React Native etc etc.
- beefield 7y agoAssuming one hates notifications, is there _any_ reason why anyone would want to use app over m(basic[1]).facebook.com? [1] to access messenger because fb stubbornly thinks I want to install their crap/spyware on my phone
- ckdarby 7y agoIt'll suck for the SEO team at LightSpeed point of sale company. FB named a open source project the same name as a company.
- pbhjpbhj 7y agoI don't know if it's clear it will suck? You just advertised their company, it's the first time I ever heard of them. It's not like LightSpeed is an unheard of name? It's a stock trader, web filter, data warehousing company, and probably a million other things. Novel names are hard to come by.
- deleted 7y ago[deleted]
- mcphage 7y agoIt's a common english phrase, as well as a scientific term. There are a lot of things named after light speed.
- atrilumen 7y ago( It's not an open source project; just a codename for the rewrite. )
- DoctorOW 7y agoI feel worse for Lightspeed web server software. Who I'm sure are after some of the search terms mentioned in this post.
- throw03172019 7y agoDoes having 40 contact screen designs seem normal?
- gigatexal 7y agoSQLite does it again! I love that they're using it for internal state management of the UI
- 1023bytes 7y agoSo it's basically MVVM with SQLite as the model?
- jconley 7y agoThis is an interesting business decision. To rewrite such a large app must have cost a fortune. Going full native is probably going to increase the cost of future development as well. Aside from the costs of writing/maintaining the code, pushing more work to the servers is an ongoing cost. Realtime, always-connected, apps are costly to run even when you push the majority of the state management to the client and just route packets around. They must really want eyeballs in their messenger app! There must be some future plans for this app that warranted such a major effort. Taking on Tik-Tok, perhaps?
- jcelerier 7y ago> To rewrite such a large app must have cost a fortune. Going full native is probably going to increase the cost of future development as well. it's a freakin chat app, and it's freaking facebook ! come on, people were doing full rewrites in entirely different languages of software insanely more complex than fb messenger back in the 90s and with near-zero tooling, eg from cobol to pascal to C or similar horrors.
- jconley 7y agoI've built a few "chat apps". I wouldn't discount the complexity. They carry with them a wide array of problem spaces. And of course anything at FB scale user counts is going to be a challenge.
- Turing_Machine 7y agoWhile I have absolutely no doubt there are scalability problems, it seems to me that most of those problems are going to be (or should be) on the back end, not in the client. How is the client 1.7 million lines of code?
- jconley 7y agoI can see it. It's pretty easy to hit that much code when you include your own code for things as trivial as a JSON parser rather than leveraging what the native SDK provides (which was alluded to in the article). It sounds like they had a bit of Not Invented Here syndrome going on and this rewrite addressed a lot of that. It also sounds like they had a bunch of systems (probably different teams even) doing similar tasks like synchronizing state. And they also had their own UI framework. All that stuff adds up to a lot of code. But, all that being said, it still has a ton of features. It's not your father's IRC client sending text around and failing to transfer files through NAT/firewalls.
- benbristow 7y agoJust downloaded the latest update on my iPhone XR. Does seem a lot more snappy and I'm loving the recent UI/UX changes too, especially the sending photos & GIF changes. Good work Facebook!
- dean177 7y ago> We extended SQLite with the capability of stored procedures, allowing Messenger feature developers to write portable, database-oriented business logic I wish the article was a little more fleshed out, I'd be interested in finding out more about how and why they went down this path
- kreetx 7y agoI just listened to the Changelog's (a podcast) episode with Richard Hipp, the author of SQLite -- I wonder if he had any part on this extension. But in any case, great to see SQLite thrive.
- SQLite 7y agoI did not. This is the first I've heard of it.
- Legogris 7y agoI have to ask, did they pay the 6k license fee yet?
- Jordanpomeroy 7y agoI love the tongue-in-cheek licensing that SQLite offers.
- tbodt 7y agoI suspect they paid for the 85k/year support package
- elamje 7y agoWow! Awesome that you chimed in here. Thanks for some great talks on YouTube and SQLite, of course.
- butz 7y agoThe loop of app building: 1. Build app with native framework. 2. Re-build app with some alternative framework which is slower, but let's you deploy single code on all platforms. 3. Re-build app with native framework, because it is faster. 4. GOTO 2
- tomaszs 7y agoPerfect :)
- robofanatic 7y agoMainframe -> Native Desktop apps -> Web apps -> Native Mobile Apps -> Mobile Web apps
- keyle 7y ago1. Developers: YEP! 2. Developers: YEP! 3. Developers: YEP! Munch Munch Code Munch WTF Munch AGILE! $$$ Munch. Designers: 1. We need a new design system. 2. We need a new brand! 3. We need a new font! Users: ¯\_(ツ)_/¯ /s <3
- nneonneo 7y agoThe best part about this cycle is that developers can always point to some metric which shows improvement to justify their actions, resulting in an Escher-like loop where they think they’re always going up. These cycles pop up all the time in development as priorities shift (or as developers find more excuses to “fix” what isn’t broken). Real world coding always involves compromise - leadership is recognizing which compromises to make without continually backpedaling.
- lord_braleigh 7y agoTo be fair, small fast messenger 2020 is "better" (aka more features / millisecond of cold start) than small fast messenger 2016. The cycle doesn't always go up monotonically, even if developers pretend it does. But it is possible to go "full-circle" through the loop and wind up in a better place than you started, and it's even possible for each stage of the loop to be truly justified given product needs.
- llovan 7y agoRIP React Native
- deleted 7y ago[deleted]
- zerubeus 7y agoMessenger was never in React Native https://reactnative.dev/showcase https://reactnative.dev/showcase
- miki123211 7y agoAm I the only one who thinks 86mb for an app is about 86 times too much? Windows Messenger was about 900k. Sure, it only did text, but Skype wasn't that big either. I'd accept 20mb for stickers, givs and stuff but 80? And 300k lines of code? For a messaging app? It just seems... unreasonable to me.
- paxys 7y agoMost of that is likely retina-friendly images/icons.
- aldanor 7y agoSo, they've reduced 1.7M lines of code to 360K. Let's pause here for a moment: - NumPy is 360K lines mostly C - Postgres is around 2.1M of C - Go 1.13 is around 1.5M of Go code - Rust 1.37 is around 1.2M of Rust code iirc - core llvm is around 3M of C++ iirc ... A chat app is 1.7M. A chat app... Makes me feel sorry for all the time spent/wasted by all those devs, many of whom are unquestionably brilliant and could've worked together on something truly awesome, big and useful. But we all know that doesn't pay the bills and so here we are.
- runeks 7y agoThe only other application in your list is Postgres. NumPy is a library. The other three are compilers. Why are you comparing these with a GUI-based chat application?
- moron4hire 7y agoI have a set of code I use for my VR projects that I've been iterating on over the last five or so years. It includes a ton of not-VR stuff, too, just stuff that I tend to include in my projects. (aside: and I'm not trying to make it a "framework". It's just my own code and it's only publicly available in the sense that I don't charge for it, don't want to waste a private Github repo on it, and won't stop anyone from using it, but I'm also not going out of my way to teach them how to use it). THAT code, my "all encompassing, personal repository for every VR app I'd ever make", is only 100K lines of code. I once downloaded all of my dependencies and counted all of those lines and still only got to 200K. Well, not counting Unity. But at that point, you might as well start counting the LoC of the OS.
- pests 7y agoFor what it's worth, GitHub private repos are now free so you don't have to sorry about wasting one.
- moron4hire 7y agoYes, I know, but I do also occasionally share code snippets out of it. If someone in a chatroom is asking how to do X, I'll just link to a source block in my repo. It's lazier than copy-pasting the code, but I also think it's good to let people see the broader context, maybe explore on their own a little. I wouldn't mind if other people started using the code, but I've been burnt too many times during attempts to push my OSS projects over the years that I just don't want to put any actual effort into attracting people anymore.
- dlsso 7y agoThey said they reduced code 84% but the numbers they gave are a 79% reduction. If they're using different metrics they should explain.
- moron4hire 7y agoDo they still block use of the web UI for Messenger in mobile browsers, unless I check "show Desktop version" in my browser settings?
- solarkraft 7y agoTo me a lot of the new architecture just seems obvious (don't keep the same view 40 times, don't invent your custom app specific everything ...) and I really wonder how the original project could derail that far. Too many resources? Institutional bloat? That said I find it a bit heart warming that all the major apps are now between 1/2 and 1/4 the size of what they were just a few years ago. I didn't expect the tech companies to ever realize the problem with insane sizes. Is a similar debloating happening to Electron apps?
- cbhl 7y agoIt looks like polls aren't yet implemented in the rewrite?
- _bxg1 7y agoWas the previous one React Native? Seeing the talk about UI abstraction layers and given that this is Facebook
- BooneJS 7y agoSounds neat, but I’ll continue to use “request desktop website” on mobile safari in a vain attempt to prevent running whatever else this app does besides chat.
- _bxg1 7y agoI'd be curious to see more details on how pub/sub works with SQLLite
- Priem19 7y agoA great way to speed up the pace to their next scandal. https://www.quitfacebook.org https://www.quitfacebook.org
- z3t4 7y agoOnce you are several years into a software project, everything feels like a weekend project, you somehow lost all sense of time-cost/benefit...
- Thorentis 7y agoI still aren't 100% sure what they're using Sqlite for? Are they storing templates as blobs? Are the storing template logic in the table? How did that make things faster? Anybody who has more detail care to explain?
- NoodleIncident 7y agoIt sounds like the entire client-side state of their app is in SQLite
- deleted 7y ago[deleted]
- AWebOfBrown 7y agoI thought Messenger was ReasonML's flagship use-case inside Facebook. If so, it will be interesting to know what impact this has on its development.
- WhyNotHugo 7y agoI don't know anyone who uses Messenger, yet, I've heard of people moving to specific countries where it's the de facto and you can't have a social life without it. I'm also aware of how iMessages and SMS are used in the US, yet this is very US-specific, and I don't believe any other country uses SMS. For Chinese people, WeChat is the standard, and what pretty much anyone uses. In Argentina and the Netherlands (and I believe much of the EU), WhatsApp is ubiquitous. Yet, I don't know a single person who uses either SMS or Messenger, or iMessages. So what truly fascinates me, is how different companies put so much work into developing such sophisticated messaging apps, but they're all reinventing the wheel and each consumed in different regions -- I think nobody would have guesses years ago that we'd have so many different apps used in different countries, and not at all inter-operating with each other.
- pottertheotter 7y agoI'm in the US. SMS / Apple Messages seems to be the default for everyone I interact with. I use Messenger sometimes, but usually only when someone else initiates. My favorite is using Apple Messages since I can send/receive from any of my Apple devices. I use macOS for other reasons, but being able to send a text from my computer is awesome.
- jianshen 7y agoDid you ever use AIM, ICQ, MSN, Y! Messenger? I'm quite certain that in a decade, there will be another batch of dominant messengers "reinventing the wheel" (IG & TikTok I'm looking at you). Real-time Communication is just such a crucial part of people's lives that people will never stop working on it, even if it feels like it's been solved.
- WhyNotHugo 7y agoI get chat these things evolve, and change over time. My fascination is that we've very equivalent things (eg: WhatsApp and Telegram aren't that far apart), duplicated even in the same generation. I did use ICQ, MSN, IRC then WhatsApp, but they didn't belong to the same periods.
- 7y ago
- djsumdog 7y agoI wonder if this will break libpurple-facebook or the Matrix-facebook-bridge
- manigandham 7y agoFacebook's video player experience is absolutely terrible.
- gagabity 7y agoKeep seeing react native pop up in the comments, there has never been any indication that Messenger used any react native from fb feom all their presentations I have see . RN is used in the Marketplace tab on the Facebook App, the Ad manager app and a few other places.
- danabramov 7y agoThis is correct. The old Messenger app is 100% native.
- jpeeler 7y agoWish they had gone into more details about the budgets. Unless a project is bug fix only for life, how can one set a binary size or lines of code upper limit? I've heard that the best developers delete more than they write, but in practice I don't think that happens very often.
- tiffanyh 7y agoDoes anyone know if FB dropped Messengers C code for WhatsApp Erlang based code?
- chendragon 7y agoNow if only they would rewrite the web application too, or release that desktop app they were talking about last year. The web app is much, much slower than the phone app.
- cjamesd 7y agoThis is a bit cynical (and borderline paranoid) but what if the reason for the rewrite was to remove privacy-violating code that was becoming a greater and greater liability? Also, wonder if they needed to do this to make way for end-to-end encryption we've been hearing about?
- noncoml 7y agoProject lightspeed required 23.94 MB / 11.83 MB to download the webpage and made the browser crawl on a i7 32Gb PC. Oh the irony..
- eyegor 7y agoI'm truly shocked how many resources are dedicated to maintaining a chat app that essentially just talks to an api. Seems like you could easily build and maintain a simple chat system with <5 developers. You wouldn't have shiny new features, but it would by coincidence be faster and simpler. Networked chat is a standard project in university.
- Panini_Jones 7y agoYou should call Facebook and tell them to fire the Messenger org because you have a great 5 person team that can do it for them.
- imron 7y ago> Seems like you could easily build and maintain a simple chat system with <5 developers Yes you could. Note however 'simple chat system'. To build a global messaging app used by hundreds of millions of people is a whole different ball game. By comparison, before acquisition by Facebook, Whatsapp had a team of ~50 people, and that was considered lean. Based on that, it would seem you're about an order of magnitude off.
- thu2111 7y agoTrue but, be aware that those 50 people did everything including the servers, the operations, the BI, oh and also maintained clients for like 8 different mobile platforms including ultra constrained ones like j2me and blackberry. If you look just at the iOS client, 5 people at WhatsApp on it would probably be a bit too high. The issue here is only partly inherent complexity of the feature set. The real problem Facebook had is one I don't see discussed in either the blog post or this thread, which was organizational. The way they structured their mobile apps was as a huge shared codebase with many disparate teams just checking code into it whenever they wanted. To the extent there was any architectural planning at all it came from some small shared library teams who were in no position, managerially, to enforce their will on the others. The blog post makes clear that a huge portion of their problem was multiple teams inventing their own ways of doing things and creating stuff that want necessary, along with a lot of pointless duplication because there was so little coordination and thus so little code reuse. The new app doesn't sound like anything special design wise, and that's the point: for the first time they've done things more conventionally. They now have someone who can dictate to every feature team "thou shalt use sqlite with these schemas" and other rules.
- adam_fallon_ 7y agoI feel like I had an aneurysm reading this. For 6 paragraphs the repeat that they shrunk the lines of code down, that the rewrote the whole thing and that it’s a massive undertaking and that a message app should be small. 6 paragraphs of that slightly reworded and I just gave up. I honestly think this was written by a bot.
- adam_fallon_ 7y agoAlso just LOOK at this empty state. 12 buttons. And that’s apparently stripped down. Yikes. https://imgur.com/gallery/drOgDwF https://imgur.com/gallery/drOgDwF
- alpacaillama 7y agoThat’s not the new version. You haven’t received the update yet.
- currysausage 7y ago"We started with the premise that Messenger needed to be a simple, lightweight utility. Some apps are immersive (video streaming, gaming); people spend hours using them. Those apps take up a lot of storage space, battery time, etc., and the trade-off makes sense. But messages are just tiny snippets of text that take less than a second to send. Fundamentally, a messaging app should be one of the smallest, lightest-weight apps on your phone. With that principle in mind, we began looking at the right way to make our iOS app significantly smaller." This paragraph just restored my faith in developer sanity.
- anant90 7y ago> And yet, for the people using the app, it won’t look or feel much different. Yikes. Okay, I know I'm maybe being a bit unfair here, but I'm sorry to say that this is one of the weakest engineering blog posts I've ever read. This seems to be a massive "let's end the craziness and finally pay our tech debt" effort. Good for them, but not something that excites me about working at Facebook.
- Smaug123 7y agoReally? I, for one, think it's very important to work somewhere that pays its tech debt on time.
- SkyMarshal 7y agoThe technical meat of this post is below. It looks like they mostly eliminated functionality in their app code wherever it was redundant with either OS functionality, SQL Lite capabilities, or the Messenger backend servers at Facebook's datacenters. >One of our main goals was to minimize code complexity and eliminate redundancies. ... To build this unified architecture, we established four principles: Use the OS, reuse the UI, leverage the SQLite database, and push to the server. >We accomplished this by using the native OS wherever possible, reusing the UI with dynamic templates powered by SQLite, using SQLite as a universal system, and building a server broker to operate as a universal gateway between Messenger and its server features. >... the existing OS often does much of what’s needed. Actions like rendering, transcoding, threading, and logging [and JSON processing] can all be handled by the OS. >To simplify and remove redundancies, we constrained the design to force the reuse of the same [UI] structure for different [UI] views. So we needed only a few categories of basic [UI] views, and those could be driven by different SQLite tables. >Now, ... All the caching, filtering, transactions, and queries are all done in SQLite. The UI merely reflects the tables in the database. >We developed a single integrated schema for all features. We extended SQLite with the capability of stored procedures, allowing Messenger feature developers to write portable, database-oriented business logic, and finally, we built a platform (MSYS) to orchestrate all access to the database, including queued changes, deferred or retriable tasks, and for data sync support. >MSYS is a cross-platform library built in C that operates all the primitives we need. ... With MSYS, we have a global view. We’re able to prioritize workloads. Say the task to load your message list should be a higher priority than the task to update whether somebody read a message in a thread from a few days ago; we can move the priority task up in the queue. >With MSYS, it’s easier to track performance, spot regressions, and fix bugs across all these features at once. In addition, we made this important part of the system exceptionally robust by investing in automated tests, resulting in a (very rare in the industry) 100 percent line code coverage of MSYS logic. >For anything that doesn’t fit into one of the categories above, we push it to the server instead. We had to build new server infrastructure to support the presence of MSYS’s single integrated data and sync layer on the client. >Coordinating logic between client and server is very complex and can be error-prone — even more so as the number of features grows. ... >Similar to MSYS on the client, we built a server broker to support all these scenarios while the actual server back-end infrastructure supports the features. >[To minimize code-base growth] We also built a system that allows us to understand how much binary weight each feature is bringing in. We hold engineers accountable for hitting their budgets as part of feature acceptance criteria. Completing features on time is important, but hitting quality targets (including but not limited to binary size budgets) is even more important.
- tim-- 7y agoI wonder what this means for older versions of Messenger? Facebook talks about rewriting their server logic to support all the removed code from the mobile interface, but does this mean that we will soon see support for < iOS 10 (which Messenger does not support for new versions, as far as I ma aware) be dropped? It's pretty sad that a Messaging app can't be run on a perfectly fine nine year old device. Bring back IRC :)
- trustfundbaby 7y agoSo ... no more React? what did they use? swift?
- stuaxo 7y agoIt's hard to be excited about anything FB do, when we know how poisonous it is.
- jbverschoor 7y agoThank you! Eventhough I've removed Messenger from my habits, I checked it out, and it's really snappy and super fast with starting up.
- danabramov 7y agoQuite a few comments seem to imply Messenger was written in React Native, so I want to clarify this is not true. Messenger was a fully native app before the rewrite, too! RN isn’t the right tradeoff for Messenger — whose new core is written in plain C — but its use at FB in general is growing, with 750+ screens in RN. So the rumours of its death are greatly exaggerated. I think it’s great to have different options with different tradeoffs available to choose from. But hey, that’s just me.
- crtlaltdel 7y agotweet thread by dan on the subject: https://twitter.com/dan_abramov/status/1234801507805138945?s=21 https://twitter.com/dan_abramov/status/1234801507805138945?s...
- chj 7y ago>from more than 1.7M lines to 360,000. At first look, I thought it is 36k, that would be truly great.
- vodkaPong 7y agoThe architecture they have ended up with is similar to that described in Out of the Tar Pit, which describes how to remove as much complexity from software as possible. By moving all state into SQLite they have implemented the "store state in relations" layer, and then written (as far as possible) functional code on top. I've been thinking about how to make my software more like this so it's interesting to see Facebook are thinking along the same lines. There's a lot of really good ideas in Out of the Tar Pit and I'd really recommend reading it.
- anthonybullard 7y agoI'll be reading this know. Thanks for the rec!
- thekid314 7y agoSecurity isn't mentioned once. I really wonder if in their meetings they sold the speed and lighter weight as a bonus for the user or for the collection of data on the user. This must reduce their overhead and be kinder on their servers.