v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days...
Transcript of v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days...
![Page 1: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/1.jpg)
vMIGRATING AN
INVOICING SYSTEM TO ELIXIR/ERLANG
@HiphooxNorberto Ortigoza
![Page 2: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/2.jpg)
HOW TO SURVIVE A REWRITE
WHERE? CONTEXT WHAT WE DID THE FINISH
![Page 3: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/3.jpg)
WHERE?01
![Page 4: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/4.jpg)
MAPA DE MÉXICOThis is where
I’m from
![Page 5: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/5.jpg)
MAPA DE MÉXICO
![Page 6: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/6.jpg)
MAPA DE MÉXICO
![Page 7: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/7.jpg)
MAPA DE MÉXICO
![Page 8: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/8.jpg)
MAPA DE MÉXICO
![Page 9: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/9.jpg)
MAPA DE MÉXICO
![Page 10: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/10.jpg)
MAPA DE MÉXICO
![Page 11: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/11.jpg)
MAPA DE MÉXICO
![Page 12: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/12.jpg)
Largest Elixir Meetups
![Page 13: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/13.jpg)
Last time we sold out in 3 weeks!
![Page 14: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/14.jpg)
MAPA DE MÉXICO
Everyone is invited!
![Page 15: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/15.jpg)
CONTEXT02
![Page 16: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/16.jpg)
• First electronic invoices in 2005.
• Electronic invoices have been mandatory since 2014.
Background
• 50 million total tax payers in Mexico.
• More electronic documents in the next years: payroll documents, birth certificates, etc.
![Page 17: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/17.jpg)
StatisticsTransactions in 2015
450,000,000
900,000,000
1,350,000,000
1,800,000,000
Inte
rfact
ura
Edic
om
Div
erza
Pega
so D
igita
l
Tral
ix
Com
erci
o D
igita
l
Solu
cion
Fac
tible
Kone
sh/A
spel
Reac
hcor
e
Solu
pac0
We were here
TOP 10 COMPANIES
![Page 18: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/18.jpg)
StatisticsTransactions in 2016
450,000,000
900,000,000
1,350,000,000
1,800,000,000
Inte
rfact
ura
Edic
om
Div
erza
Pega
so D
igita
l
Tral
ix
Com
erci
o D
igita
l
Solu
cion
Fac
tible
Kone
sh/A
spel
Reac
hcor
e
Solu
pac0
We’ll be here!
TOP 10 COMPANIES
![Page 19: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/19.jpg)
• 700 millions transactions by the end of 2016.
Statistics
• 44 transactions per second.
• Company has 341,000 users.
SO…
That’s it!? Really!?
![Page 20: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/20.jpg)
IT WAS NOT ABOUT PERFORMANCE OR THROUGHPUT
![Page 21: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/21.jpg)
IT WAS ABOUT AVAILABILITY AND COST REDUCTION
![Page 22: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/22.jpg)
• Clients have critical business processes that depend on getting the invoices online.
Requirements
• Tax authority (SAT) has heavy fines if our clients or Diverza don’t deliver invoices on time.
• If not, they can lose money, clients or merchandise.
• System needs to be available all the time.
• We were paying a lot of money for infrastructure.
![Page 23: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/23.jpg)
End of last year
We started working here
Growth in the last years
![Page 24: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/24.jpg)
Document ValidationStructure & data
Invoicing processClient ValidationCredentials & payment status
Invoice CreationStructure
Invoice CertificationDigital signatures
Invoice DeliveryTax authority (SAT) & Email to client
Invoice ResponseTo client
Asynchronously
![Page 25: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/25.jpg)
ONCE UPON A TIME THERE WAS A SYSTEM…
![Page 26: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/26.jpg)
Our servers 15 in totalOur clients
Hundreds of them
Java ServersWeb Services
SQL ServerInvoice DB
Java clientBatch processing
Legacy System
Our clients Thousands of them
Any technologyOnline processing
Hardware Security Module(HSM)Digital signature
SOAP
SOAP
Wow!
![Page 27: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/27.jpg)
Physical Servers
• Operating System: ESX
• Processor:Dual Processor, Octo Core Intel 2.70GHz.
• Memory:128 GB (Std.)
• 2 Type-1 Hypervisors
![Page 28: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/28.jpg)
Java Servers• vCPUs: 4
• Memory: 18 - 24 GB
• Hard Drive: 50 GB
• OS: Windows Server 2008
• Web Server: Apache
What!?
![Page 29: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/29.jpg)
Resultado de Pruebas a Timbre FiscalTr
ansa
ctio
ns p
er s
econ
d
10
20
30
40
Concurrent users
90 150 180 190 210
Legacy System
Concurrent Users
It crashed! 😱
![Page 30: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/30.jpg)
• Downtimes because of memory leaks and manual deployments.
• Multiples copies of the system in order to manage crashes and isolation.
• These copies weren’t synchronized. Some were months apart.
Status
• It consumes a lot of resources: servers, RAM, etc.
![Page 31: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/31.jpg)
Status• Fixing simple bugs takes too long because of the
dependencies in existing code.
• Adding new features takes too long, and costs too much (hard to avoid side effects and therefore we affected existing features).
• Testing takes too long (Manual).
![Page 32: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/32.jpg)
• General and client specific rules mixed together.
• Around 5,000 fop templates, some of them very complex.
Status
• We used a very old java library for PDF generation (FOP).
• Outdated libraries, couldn’t replace them because of compatibility problems.
![Page 33: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/33.jpg)
WHAT WE WERE THINKING AT THAT MOMENT?
![Page 34: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/34.jpg)
![Page 35: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/35.jpg)
![Page 36: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/36.jpg)
WHAT WE DID?03
![Page 37: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/37.jpg)
![Page 38: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/38.jpg)
WAIT!
![Page 39: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/39.jpg)
– Joel on software
They did … the single worst strategic mistake that any software company can make:
They decided to rewrite the code from scratch.
“
”
![Page 40: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/40.jpg)
![Page 41: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/41.jpg)
DO WE REALLY NEED TO REWRITE EVERYTHING?
![Page 42: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/42.jpg)
Strategy
Start the big rewrite if still needed
Replace the java client with a Go
program
Start small projects in Erlang/Elixir
Fix as much as possible the old
system
Train the team in Erlang & Elixir
Get fired for incompetence
![Page 43: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/43.jpg)
SOUNDS LIKE A GOOD PLAN!
![Page 44: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/44.jpg)
LETS TRY IT!
![Page 45: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/45.jpg)
HOW LONG CAN IT TAKE?
![Page 46: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/46.jpg)
WHAT CAN GO WRONG?
![Page 47: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/47.jpg)
Fixing the Old System• We made changes to the Java System in order
to support the new load.
• We updated most of the libraries, operating systems and applications servers.
• We rewrote small parts and replaced some modules.
![Page 48: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/48.jpg)
Fixing Old System
• Improved deployment system.
• Changed Data Center (Nightmare, please don't do this).
• Removed some copies of the system.
• Managed to support increased load from 2013 to 2015.
![Page 49: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/49.jpg)
Replacing the Client with Go
• It eliminates dependencies. Doesn't need a runtime preinstalled.
• It supports multiple platforms.
• It has good support for concurrency.
This one doesn't need high availabilityIt’s ok for Go 😉
• It is very fast!
![Page 50: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/50.jpg)
Training the Team• We created a 2 days Elixir/Erlang/Phoenix
course.
• We gave the course for free for 1 and a half years and received feedback.
• Now we have a 7 days course! 😀
• We created the Mexico City Elixir group.
• More than 100 people trained in total.
![Page 51: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/51.jpg)
Small Projects in Elixir
• We created a proxy using Dynamo just before Valim announced that it was deprecated 😧
• Some time later we replaced that proxy with Phoenix. 😉
• Hardware Secure Module (HSM) emulator.
• A lot of Proofs of Concept (POCs).
![Page 52: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/52.jpg)
The Big Rewrite• We had luck! New version of the Invoice
standard came out.
• A team of 5 people was created.• 2 people doing elixir development.• 1 person doing deployment.• 2 people doing test design and test
automation.
• We still had problems with costs and slow development cycle.
![Page 53: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/53.jpg)
The Big Rewrite
• We rewrote the system one time (to use OTP Applications) in 3 months.
• We restructured it one time (to use Umbrella projects and isolate Phoenix). 1 week.
• We wrote a first version in 6 months (part- time). Just one Phoenix App.
Happy for Chris’ keynote!
![Page 54: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/54.jpg)
Our servers 15 in totalOur clients
Hundreds of them
Java ServersWeb Services
SQL ServerInvoice DB
Java clientBatch processing
Previous System
Our clients Thousands of them
Any technologyOnline processing
Hardware Security Module(HSM)Digital signature
SOAP
SOAP
![Page 55: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/55.jpg)
Our servers (4 in total)Our clients
Hundreds of them
Elixir ServerWeb Services
SQL ServerRepo
Go clientBatch processing
The Big Rewrite
Our clients Thousands of them
Any technologyOnline processing HSM Hardware
Digital signature
Java ServicePDF
HSM SoftwareDigital signature
Python/C
XML SchemaValidation
REST
REST
![Page 56: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/56.jpg)
ValidationsCerberus
PDFJava
HSM-SWHsm-Server
Web ServicesCetus
InvoiceKirke
Doc RouterHades
SignatureThanatos
Client DeliveryHermes
Elixir System
SAT SenderRheia-Client
|>
|>
|>
|>
|>
|>
|>
HSM-HWHsm-Server
Request
Python/CPorts
SAT DeliveryRheia-Server
Java/PythonOTP Application
Phoenix AppElixir Module
Hardware
![Page 57: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/57.jpg)
Elixir Servers• vCPUs: 2
• Memory: 8 GB
• Hard Drive: 50 GB
• OS: Red Hat Enterprise Linux 6 (64 bit)
![Page 58: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/58.jpg)
JUNE
SEPTEMBER
DECEMBER
2013 2014 2015 2016
Start fixing the old system
Start evaluation of Erlang and do proofs of concept
Start rewrite of Java client in Go
JULY
APRIL
AUGUST
FEBRUARY
AUGUSTStart two first projects in Elixir (Proxy and HSM emulator)
Start big rewrite
Two full-time people in the rewrite
Start final tests
deployment in production
Today
FINAL TIMELINE
It just took 3 years!
![Page 59: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/59.jpg)
THE FINISH04
![Page 60: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/60.jpg)
• PDF Generation uses Java, but no longer uses Application Servers.
• XML Schema validation uses a Python library and Erlang Ports.
• Best performance and latency.
• PostgreSQL for development and SQLServer in production.
New System
![Page 61: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/61.jpg)
New System• Deployment using Ansible and Erlang releases
(exrm).
• Test suit with 990 tests, takes 5 minutes to run.
• You can develop and test everything without any external dependency.
• We also have a Single Sign-On service in Erlang.
![Page 62: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/62.jpg)
New System
• Flexibility to add new requirements very quickly.
• No memory leaks.
• Centralized error management.
• 35 KLOCs in Elixir vs 500 KLOCs in Java.
![Page 63: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/63.jpg)
Resultado de Pruebas a Timbre FiscalTr
ansa
ctio
ns P
er S
econ
d
45
90
135
180
00:01 00:03 00:05 00:07 00:09 00:11 00:13 00:15
116
152
180
168 172
141
130
145
129
177
150 147139 142 138
12
3441 38
3139
20
48
27
15
4437
25 29 25
Java Erlang/Elixir
Max transactions/sec
![Page 64: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/64.jpg)
Resultado de Pruebas a Timbre FiscalTr
ansa
ctio
ns p
er s
econ
d
40
80
120
160
Concurrent users
90 150 180 190 210
Java Erlang/Elixir
Concurrent users
![Page 65: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/65.jpg)
0
10
20
30
40
50
60
70
80
90
100
CPU00
1
CPU00
2
CPUbyProcessordm-ca0523/12/2015(0threadsnotshown)User% Sys% Wait%
Performance - CPU
![Page 66: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/66.jpg)
0
100
200
300
400
500
600
700
800
900
beam
.smp
even
ts/0
even
ts/1
kblockd/0
kjou
rnald
nova-agent
python
rackspace-mon
it
run_
erl
watchdo
g/0
Memorybycommand(MBytes)dm-ca0523/12/2015Min. Avg. Max.
Performance - Memory< 1 GB! 😱
![Page 67: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/67.jpg)
Final Words
• You will need support from the CEO.
• If you don’t have time it will cost more money.
• You need to have a training path for your team.
• It can take a long time. Be prepared for that.
![Page 68: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/68.jpg)
Final Words
• Be patient, sometimes you need to wait for the right time. Be ready for that moment.
• You are going to support the old system for a long period of time.
• Team really loves Erlang & Elixir. People get motivated.
• Erlang is awesome for binary protocols.
![Page 69: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/69.jpg)
Final Words
• Sometimes you can’t trash everything from the old system. That’s fine.
• You don’t need to trash everything from the old system. Be open to reuse legacy code.
• Erlang is good to orchestrate other systems.
![Page 70: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/70.jpg)
Final Words
• Don't be afraid of changing direction and make big changes.
• From one monolithic project to going crazy with different repos to finally use umbrella projects.
• 4 months to have someone to understand and use OTP.
![Page 71: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/71.jpg)
THANKS AND…
![Page 72: v INVOICING SYSTEM TO ELIXIR/ERLANG...• It is very fast! Training the Team • We created a 2 days Elixir/Erlang/Phoenix course. • We gave the course for free for 1 and a half](https://reader034.fdocuments.us/reader034/viewer/2022050518/5fa23cadfcf18d6ca3505e8e/html5/thumbnails/72.jpg)
SEE YOU IN MEXICO!
@HiphooxNorberto