SlideShare una empresa de Scribd logo
1 de 39
From 1000/day to 1000/sec 
The evolution of our big data system 
Yoav Cohen 
VP Engineering
This Talk 
A walk-through of how we built our big-data system 
Incapsula, Inc. / Proprietary and Confidential. 2 All Rights Reserved.
About Incapsula 
Vendor of a cloud-based Application Delivery Controller 
Web Application 
Firewall 
Incapsula, Inc. / Proprietary and Confidential. 3 All Rights Reserved. 
Load- 
Balancing 
CDN & 
Optimizer 
DDoS 
Protection
How does it work? 
Incapsula, Inc. / Proprietary and Confidential. 4 All Rights Reserved.
Modeling Web-Traffic 
1. First request to a website starts a new session 
2. Subsequent requests are part of the same session 
3. After being idle for 30 minutes the session ends 
Session 1 starts 10:03:01 GET www.incapsula.com/ 
Session 1 request 1 10:03:10 GET www.incapsula.com/ddos 
Session 1 request 2 10:03:12 GET www.incapsula.com/cdn 
… … 
Session 1 ends 
Session 2 starts 10.35:05 GET www.incapsula.com/signup 
Incapsula, Inc. / Proprietary and Confidential. 5 All Rights Reserved.
The Data 
A stream of messages in Google Protobuf format 
msgTid: 144021710000000001 
ype: SESSION_MESSAGE_CREATE 
siteID: 7 
startTime: 1409578192017 
clientIP: ****** 
countryCode: "US" 
entryUrlID: 5544402418256865164 
visitorID: "7e59c804-f663-4595-a0df-35d9b02eb747" 
userAgent: "Incapsula Site Monitor - OPS" 
visitorClAppId: 209 
… 
Incapsula, Inc. / Proprietary and Confidential. 6 All Rights Reserved. 
requestStartTime: 1410004769258 
responseStartTime: 1410004769258 
responseEndTime: 1410004769261 
sessionID: 151009030147748952 
urlID: 5544402418256865164 
request_id: 567472919066130553 
queryString: "" 
postBody: "" 
statusCode: 200 
serialNumber: 1 
content_length: 6350 
protocol: HTTP 
requestResult: REQ_CACHED_FRESH 
...
The Problem 
Transforming the stream of messages to readable data 
• Processing throughput 
• Read performance 
• Scalability 
Incapsula, Inc. / Proprietary and Confidential. 7 All Rights Reserved. 
? 
Session 1 starts 
Session 1 request 1 
Session 1 request 2 
… 
Session 1 ends 
Session 2 starts 
…
Architecture 
Incapsula, Inc. / Proprietary and Confidential. 8 All Rights Reserved.
Gen 1 
2010 – 2011 
Incapsula, Inc. / Proprietary and Confidential. 9 All Rights Reserved. 
Gen 2 
2011 – 2013 
Gen 3 
2013 
Gen 4 
2015 
System Evolution
Gen 1: Code Name “rtproc” 
Incapsula, Inc. / Proprietary and Confidential. 10 All Rights Reserved.
Gen 1: OLAP Cube 
• A text book solution 
• Time x IP x Country x …  # requests, # attacks, … 
• Slice and dice to answer any question (how many attack from 
Germany in Jan-2010?) 
Incapsula, Inc. / Proprietary and Confidential. 11 All Rights Reserved. 
dimensions counters 
select sum(number_of_attacks) from Attacks where 
site_id=140 and country_code=‘DE’ and time > ‘20100100’ 
and time < ‘20100200’
Gen 1: OLAP Cube 
• Loading data for individual attacks requires joins: 
Incapsula, Inc. / Proprietary and Confidential. 12 All Rights Reserved.
Gen 1: Analysis 
• Generic solution 
• Very big tables 
• Overly complex (lots of moving parts) 
Processing 
Read 
Scalability 
Incapsula, Inc. / Proprietary and Confidential. 13 All Rights Reserved.
Gen 1 
2010 – 2011 
Incapsula, Inc. / Proprietary and Confidential. 14 All Rights Reserved. 
Gen 2 
2011 – 2013 
Gen 3 
2013 
Gen 4 
2015 
System Evolution
Gen 2: Code Name “rtprocng” 
• Main problems to solve: 
> Read Performance 
> Simplify 
• New approach: 
> Count things on the edge instead of centrally 
> NoSQL model to improve read performance (no joins) 
Incapsula, Inc. / Proprietary and Confidential. 15 All Rights Reserved.
Gen 2: Simpler Design 
Incapsula, Inc. / Proprietary and Confidential. 16 All Rights Reserved.
Gen 2: Stats NoSQL Storage 
• One document per day, containing 
all the data to build the charts 
• Read performance improved (one 
lookup for all charts) 
• Can even load parts of the data 
(MongoDB feature) 
Incapsula, Inc. / Proprietary and Confidential. 17 All Rights Reserved. 
{"_id" : "7_09-04-2014", 
"pageviews" : [ 
NumberLong(2369), 
NumberLong(2380), 
NumberLong(2520), 
NumberLong(5651), 
NumberLong(2912), 
NumberLong(3357), 
NumberLong(3723), 
NumberLong(3301), 
NumberLong(3092), 
NumberLong(2984), 
NumberLong(3791), 
NumberLong(3069) 
], 
"humsess" : [ 
NumberLong(213), 
NumberLong(258), 
NumberLong(298), 
…
Gen 2: Events NoSQL Storage 
• One document per session, containing 
all its actions 
• Lookups are easy (no joins) 
• Searches use MongoDB indexes (OK 
but not great) 
Incapsula, Inc. / Proprietary and Confidential. 18 All Rights Reserved. 
{ 
"_id": 226000330131098770, 
"start": { 
"$date": "2014-09-09T10:19:00Z" 
}, 
"cc": ["CA"], 
"securityFlags": ["rid4"], 
"badbot": true, 
"prxy": [226], 
"clappt": 1, 
"actns": [ 
{ 
"reqRes": 10, 
"u": "www.incapsula.com/", 
"attack": [ 
{ 
"loc": 1, 
"acode": 0, 
"act": 7, 
"rid": 4, 
"more": 0, 
"atype": 314, 
"hidden": false, 
"match": "", 
"pval": "" 
} 
...
Gen 2: Python Processor 
• Batch process: 
> Process the files in the directory for up to X minutes 
> Flush to storage and exit 
• How to achieve good processing throughput? 
> Cache objects in memory 
> When processing messages, update object in memory 
> When process finishes, flush all the objects from memory to 
storage 
Incapsula, Inc. / Proprietary and Confidential. 19 All Rights Reserved.
Gen 2 Storage Bottleneck 
• Single DB for all sessions 
• Reality check: 
> MongoDB coarse-grained locking (lock per DB server) 
> When batch process flushes, UIs are stuck (lock prefers writes) 
> Dropping old data impossible 
> Fragmentation caused excessive disk usage 
Incapsula, Inc. / Proprietary and Confidential. 20 All Rights Reserved.
Gen 2 Storage Re-Factoring 
• Single DB  DB per day 
> Drop DBs that are X days old 
• Live sessions  Live DB 
“Dead” sessions  per-day DB 
> 0% fragmentation in per-day DBs 
> Daily maintenance of Live DB (but it’s relatively small) 
• DB locking not resolved (later MongoDB versions 
have lock per DB) 
Incapsula, Inc. / Proprietary and Confidential. 21 All Rights Reserved.
Gen 2: Analysis 
• Simple and scalable 
• MongoDB is easy to get started with 
> Over time TCO increases 
• Reached batch processing limits 
Processing 
Read 
Scalability 
Incapsula, Inc. / Proprietary and Confidential. 22 All Rights Reserved.
Gen 1 
2010 – 2011 
Incapsula, Inc. / Proprietary and Confidential. 23 All Rights Reserved. 
Gen 2 
2011 – 2013 
Gen 3 
2013 
Gen 4 
2015 
System Evolution
Gen 3: Code Name “Graceland” 
• Main problems to solve: 
> Faster, online processing 
> Better search capabilities 
• New approach: 
> Multi-threaded Java-based processor: 
- Faster protobuf library than python 
- Keep objects in memory for longer periods of time and reduce flushes 
to storage 
> Lucene for search 
> A DB we can understand and control 
Incapsula, Inc. / Proprietary and Confidential. 24 All Rights Reserved.
Gen 3: Design 
Incapsula, Inc. / Proprietary and Confidential. 25 All Rights Reserved.
Gen 3: Multi-Threaded Java Processor 
• One reader thread reads the 
files and distributes the data 
between the workers 
• Workers process the data 
> Load object from cache 
> If not in cache, load from 
storage 
> Update object 
> Flush to storage 
- Periodically 
- On certain events 
Incapsula, Inc. / Proprietary and Confidential. 26 All Rights Reserved.
Gen 3: Cache Design 
• Design goal: large cache, but not all in JVM heap 
• Layered LRU cache (extends LinkedHashMap) 
• One layer is the map, backing layer on tmpfs or disk 
Incapsula, Inc. / Proprietary and Confidential. 27 All Rights Reserved.
Gen 3 Stats Storage (“Segmented Storage”) 
• Binary file per day 
• Keep recent files separate, archive older files 
2014-02-03 2014-02-03.pbz 0 14325654845 
2014-02-02 2014-02-02.pbz 0 14326542128 
2014-02-01 2014-02-03.pbz 0 14325654845 
2014-01-31 archive.pbz 76515 14325654845 
... 
2014-01-01 archive.pbz 0 14365428845 
Incapsula, Inc. / Proprietary and Confidential. 28 All Rights Reserved.
Gen 3 Stats Storage (Segmented Storage) 
• Files are served via nginx 
• Clients keep cache 
Incapsula, Inc. / Proprietary and Confidential. 29 All Rights Reserved.
Gen 3 Events Storage 
• Tried different DBs: 
> LevelDB, KyotoCabinet 
- Storing the raw session data inside the lucene index 
- Index memory footprint grew (all the session data got 
memory-mapped) 
> LevelDB, KyotoCabinet 
- Couldn’t get these to work reliably 
> Cassandra 
- Rule of thumb: if your DB has its own conference, you 
need a DBA 
- We felt it’s easier to write our own than read the docs 
Incapsula, Inc. / Proprietary and Confidential. 30 All Rights Reserved.
Gen 3 Events Storage (“Indexing Partition”) 
• A partition (directory) per-day, containing: 
> Lucene index of sessions 
> Big file with sessions in it 
• Same approach as in Gen 2 for live sessions: 
> Live sessions  Live partition 
> Dead sessions  per-day partitions 
> 0% fragmentation 
> Complicates searching a bit 
> Live partitions require cleanup 
or re-building 
Incapsula, Inc. / Proprietary and Confidential. 31 All Rights Reserved.
Gen 3 Events Storage (“Indexing Partition”) 
• Searches are more efficient: 
> Search requests are served directly from index 
> Session data is loaded only on-demand, and via nginx using HTTP 
Range header 
Incapsula, Inc. / Proprietary and Confidential. 32 All Rights Reserved.
Gen 3: Analysis 
• Good processing throughput 
• Good read performance 
• Reaching JVM issues (big heap) 
Processing 
Read 
Scalability 
Incapsula, Inc. / Proprietary and Confidential. 33 All Rights Reserved.
Gen 1 
2010 – 2011 
Incapsula, Inc. / Proprietary and Confidential. 34 All Rights Reserved. 
Gen 2 
2011 – 2013 
Gen 3 
2013 
Gen 4 
2015 
System Evolution
Gen 4: 2015 
• Based on Gen 3 
• Distribute work to more than one system 
> One data server in each POP (> 20 POPs) 
> Each POP processes and stores its own data 
> Upload processed outputs to central servers or search on all POP 
servers 
Incapsula, Inc. / Proprietary and Confidential. 35 All Rights Reserved.
Summary 
• It is equally important to understand how your system works 
as it is to understand every other aspect of your business 
• At some point we realized it’s better for us to build our 
software from scratch than use off the shelves products as 
black-boxes: 
> We need to find people who know the products 
- Which is crazy since we tried tons of them over the last 4 years 
> We usually have less requirements 
- Who needs multi-DC replication since day 1? 
> We prefer coding it than reading documentations and 
stackoverflows 
- Then we can hack it in the middle of the night if needed 
- It’s way more fun (at least for the developers…) 
Incapsula, Inc. / Proprietary and Confidential. 36 All Rights Reserved.
Questions? 
Incapsula, Inc. / Proprietary and Confidential. 37 All Rights Reserved.
Types of Data 
Statistics – just numbers, used for charts, billing, etc. 
Incapsula, Inc. / Proprietary and Confidential. 38 All Rights Reserved.
Types of Data 
Events – in-depth information, used for forensics and research 
Incapsula, Inc. / Proprietary and Confidential. 39 All Rights Reserved.

Más contenido relacionado

La actualidad más candente

SANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedSANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedMicah Hoffman
 
Naxsi, an open source WAF for Nginx
Naxsi, an open source WAF  for NginxNaxsi, an open source WAF  for Nginx
Naxsi, an open source WAF for NginxPositive Hack Days
 
Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2drewz lin
 
Pro Tips for Power Users – Palo Alto Networks Live Community and Fuel User Gr...
Pro Tips for Power Users – Palo Alto Networks Live Community and Fuel User Gr...Pro Tips for Power Users – Palo Alto Networks Live Community and Fuel User Gr...
Pro Tips for Power Users – Palo Alto Networks Live Community and Fuel User Gr...PaloAltoNetworks
 
Android pentesting the hackers-meetup
Android pentesting the hackers-meetupAndroid pentesting the hackers-meetup
Android pentesting the hackers-meetupkunwaratul hax0r
 
Abusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec gloryAbusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec gloryPriyanka Aash
 
DevSecCon Tel Aviv 2018 - Serverless Security
DevSecCon Tel Aviv 2018 - Serverless SecurityDevSecCon Tel Aviv 2018 - Serverless Security
DevSecCon Tel Aviv 2018 - Serverless SecurityAvi Shulman
 
Migrating from Akamai to Incapsula: What You Need to Know
Migrating from Akamai to Incapsula: What You Need to KnowMigrating from Akamai to Incapsula: What You Need to Know
Migrating from Akamai to Incapsula: What You Need to KnowImperva Incapsula
 
Web Application Security And Getting Into Bug Bounties
Web Application Security And Getting Into Bug BountiesWeb Application Security And Getting Into Bug Bounties
Web Application Security And Getting Into Bug Bountieskunwaratul hax0r
 
Incapsula: How to Increase SaaS Websites’ Uptime and Accelerate Performance
Incapsula: How to Increase SaaS Websites’ Uptime and Accelerate PerformanceIncapsula: How to Increase SaaS Websites’ Uptime and Accelerate Performance
Incapsula: How to Increase SaaS Websites’ Uptime and Accelerate PerformanceImperva Incapsula
 
When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014Anant Shrivastava
 
CSW2017 chuanda ding_state of windows application security
CSW2017 chuanda ding_state of windows application securityCSW2017 chuanda ding_state of windows application security
CSW2017 chuanda ding_state of windows application securityCanSecWest
 
Dev secops on the offense automating amazon web services account takeover
Dev secops on the offense  automating amazon web services account takeoverDev secops on the offense  automating amazon web services account takeover
Dev secops on the offense automating amazon web services account takeoverPriyanka Aash
 
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)Sam Bowne
 
OWASP ATL - Social Engineering Technical Controls Presentation
OWASP ATL - Social Engineering Technical Controls PresentationOWASP ATL - Social Engineering Technical Controls Presentation
OWASP ATL - Social Engineering Technical Controls PresentationOWASP Atlanta
 
Fruit vs Zombies: Defeat Non-jailbroken iOS Malware by Claud Xiao
Fruit vs Zombies:  Defeat Non-jailbroken iOS Malware by Claud XiaoFruit vs Zombies:  Defeat Non-jailbroken iOS Malware by Claud Xiao
Fruit vs Zombies: Defeat Non-jailbroken iOS Malware by Claud XiaoShakacon
 
iOS malware: what's the risk and how to reduce it
iOS malware: what's the risk and how to reduce itiOS malware: what's the risk and how to reduce it
iOS malware: what's the risk and how to reduce itCyber Security Alliance
 
Outlook and Exchange for the bad guys
Outlook and Exchange for the bad guysOutlook and Exchange for the bad guys
Outlook and Exchange for the bad guysNick Landers
 
I Want More Ninja – iOS Security Testing
I Want More Ninja – iOS Security TestingI Want More Ninja – iOS Security Testing
I Want More Ninja – iOS Security TestingJason Haddix
 
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016Chris Gates
 

La actualidad más candente (20)

SANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedSANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection Exploited
 
Naxsi, an open source WAF for Nginx
Naxsi, an open source WAF  for NginxNaxsi, an open source WAF  for Nginx
Naxsi, an open source WAF for Nginx
 
Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2
 
Pro Tips for Power Users – Palo Alto Networks Live Community and Fuel User Gr...
Pro Tips for Power Users – Palo Alto Networks Live Community and Fuel User Gr...Pro Tips for Power Users – Palo Alto Networks Live Community and Fuel User Gr...
Pro Tips for Power Users – Palo Alto Networks Live Community and Fuel User Gr...
 
Android pentesting the hackers-meetup
Android pentesting the hackers-meetupAndroid pentesting the hackers-meetup
Android pentesting the hackers-meetup
 
Abusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec gloryAbusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec glory
 
DevSecCon Tel Aviv 2018 - Serverless Security
DevSecCon Tel Aviv 2018 - Serverless SecurityDevSecCon Tel Aviv 2018 - Serverless Security
DevSecCon Tel Aviv 2018 - Serverless Security
 
Migrating from Akamai to Incapsula: What You Need to Know
Migrating from Akamai to Incapsula: What You Need to KnowMigrating from Akamai to Incapsula: What You Need to Know
Migrating from Akamai to Incapsula: What You Need to Know
 
Web Application Security And Getting Into Bug Bounties
Web Application Security And Getting Into Bug BountiesWeb Application Security And Getting Into Bug Bounties
Web Application Security And Getting Into Bug Bounties
 
Incapsula: How to Increase SaaS Websites’ Uptime and Accelerate Performance
Incapsula: How to Increase SaaS Websites’ Uptime and Accelerate PerformanceIncapsula: How to Increase SaaS Websites’ Uptime and Accelerate Performance
Incapsula: How to Increase SaaS Websites’ Uptime and Accelerate Performance
 
When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014
 
CSW2017 chuanda ding_state of windows application security
CSW2017 chuanda ding_state of windows application securityCSW2017 chuanda ding_state of windows application security
CSW2017 chuanda ding_state of windows application security
 
Dev secops on the offense automating amazon web services account takeover
Dev secops on the offense  automating amazon web services account takeoverDev secops on the offense  automating amazon web services account takeover
Dev secops on the offense automating amazon web services account takeover
 
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
 
OWASP ATL - Social Engineering Technical Controls Presentation
OWASP ATL - Social Engineering Technical Controls PresentationOWASP ATL - Social Engineering Technical Controls Presentation
OWASP ATL - Social Engineering Technical Controls Presentation
 
Fruit vs Zombies: Defeat Non-jailbroken iOS Malware by Claud Xiao
Fruit vs Zombies:  Defeat Non-jailbroken iOS Malware by Claud XiaoFruit vs Zombies:  Defeat Non-jailbroken iOS Malware by Claud Xiao
Fruit vs Zombies: Defeat Non-jailbroken iOS Malware by Claud Xiao
 
iOS malware: what's the risk and how to reduce it
iOS malware: what's the risk and how to reduce itiOS malware: what's the risk and how to reduce it
iOS malware: what's the risk and how to reduce it
 
Outlook and Exchange for the bad guys
Outlook and Exchange for the bad guysOutlook and Exchange for the bad guys
Outlook and Exchange for the bad guys
 
I Want More Ninja – iOS Security Testing
I Want More Ninja – iOS Security TestingI Want More Ninja – iOS Security Testing
I Want More Ninja – iOS Security Testing
 
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
 

Destacado

Is the Cloud Going to Kill Traditional Application Delivery?
Is the Cloud Going to Kill Traditional Application Delivery?Is the Cloud Going to Kill Traditional Application Delivery?
Is the Cloud Going to Kill Traditional Application Delivery?Imperva Incapsula
 
A DevOps Guide to Web Application Security
A DevOps Guide to Web Application SecurityA DevOps Guide to Web Application Security
A DevOps Guide to Web Application SecurityImperva Incapsula
 
Overview of SSL: choose the option that's right for you
Overview of SSL: choose the option that's right for youOverview of SSL: choose the option that's right for you
Overview of SSL: choose the option that's right for youCloudflare
 
Running a Robust DNS Infrastructure with CloudFlare Virtual DNS
Running a Robust DNS Infrastructure with CloudFlare Virtual DNSRunning a Robust DNS Infrastructure with CloudFlare Virtual DNS
Running a Robust DNS Infrastructure with CloudFlare Virtual DNSCloudflare
 
Hardening Microservices Security: Building a Layered Defense Strategy
Hardening Microservices Security: Building a Layered Defense StrategyHardening Microservices Security: Building a Layered Defense Strategy
Hardening Microservices Security: Building a Layered Defense StrategyCloudflare
 
Latest Trends in Web Application Security
Latest Trends in Web Application SecurityLatest Trends in Web Application Security
Latest Trends in Web Application SecurityCloudflare
 

Destacado (8)

Is the Cloud Going to Kill Traditional Application Delivery?
Is the Cloud Going to Kill Traditional Application Delivery?Is the Cloud Going to Kill Traditional Application Delivery?
Is the Cloud Going to Kill Traditional Application Delivery?
 
A DevOps Guide to Web Application Security
A DevOps Guide to Web Application SecurityA DevOps Guide to Web Application Security
A DevOps Guide to Web Application Security
 
CloudFlare CDN + Drupal
CloudFlare CDN + DrupalCloudFlare CDN + Drupal
CloudFlare CDN + Drupal
 
Cloudflare
CloudflareCloudflare
Cloudflare
 
Overview of SSL: choose the option that's right for you
Overview of SSL: choose the option that's right for youOverview of SSL: choose the option that's right for you
Overview of SSL: choose the option that's right for you
 
Running a Robust DNS Infrastructure with CloudFlare Virtual DNS
Running a Robust DNS Infrastructure with CloudFlare Virtual DNSRunning a Robust DNS Infrastructure with CloudFlare Virtual DNS
Running a Robust DNS Infrastructure with CloudFlare Virtual DNS
 
Hardening Microservices Security: Building a Layered Defense Strategy
Hardening Microservices Security: Building a Layered Defense StrategyHardening Microservices Security: Building a Layered Defense Strategy
Hardening Microservices Security: Building a Layered Defense Strategy
 
Latest Trends in Web Application Security
Latest Trends in Web Application SecurityLatest Trends in Web Application Security
Latest Trends in Web Application Security
 

Similar a From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surge2014]

DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataDatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataHakka Labs
 
Taking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionTaking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionSplunk
 
Essential Data Engineering for Data Scientist
Essential Data Engineering for Data Scientist Essential Data Engineering for Data Scientist
Essential Data Engineering for Data Scientist SoftServe
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2aspyker
 
OVHcloud – Enterprise Cloud Databases
OVHcloud – Enterprise Cloud DatabasesOVHcloud – Enterprise Cloud Databases
OVHcloud – Enterprise Cloud DatabasesOVHcloud
 
Scality S3 Server: Node js Meetup Presentation
Scality S3 Server: Node js Meetup PresentationScality S3 Server: Node js Meetup Presentation
Scality S3 Server: Node js Meetup PresentationScality
 
Data Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFixData Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFixC4Media
 
5 Pitfalls to Avoid with MongoDB
5 Pitfalls to Avoid with MongoDB5 Pitfalls to Avoid with MongoDB
5 Pitfalls to Avoid with MongoDBTim Callaghan
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Cloudera, Inc.
 
Building a data pipeline to ingest data into Hadoop in minutes using Streamse...
Building a data pipeline to ingest data into Hadoop in minutes using Streamse...Building a data pipeline to ingest data into Hadoop in minutes using Streamse...
Building a data pipeline to ingest data into Hadoop in minutes using Streamse...Guglielmo Iozzia
 
Logs @ OVHcloud
Logs @ OVHcloudLogs @ OVHcloud
Logs @ OVHcloudOVHcloud
 
Low level java programming
Low level java programmingLow level java programming
Low level java programmingPeter Lawrey
 
Advanced Administration, Monitoring and Backup
Advanced Administration, Monitoring and BackupAdvanced Administration, Monitoring and Backup
Advanced Administration, Monitoring and BackupMongoDB
 
OS for AI: Elastic Microservices & the Next Gen of ML
OS for AI: Elastic Microservices & the Next Gen of MLOS for AI: Elastic Microservices & the Next Gen of ML
OS for AI: Elastic Microservices & the Next Gen of MLNordic APIs
 
Scylla Summit 2022: Stream Processing with ScyllaDB
Scylla Summit 2022: Stream Processing with ScyllaDBScylla Summit 2022: Stream Processing with ScyllaDB
Scylla Summit 2022: Stream Processing with ScyllaDBScyllaDB
 
Introduction to IBM Spectrum Scale and Its Use in Life Science
Introduction to IBM Spectrum Scale and Its Use in Life ScienceIntroduction to IBM Spectrum Scale and Its Use in Life Science
Introduction to IBM Spectrum Scale and Its Use in Life ScienceSandeep Patil
 

Similar a From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surge2014] (20)

DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataDatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
 
Taking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionTaking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout Session
 
Essential Data Engineering for Data Scientist
Essential Data Engineering for Data Scientist Essential Data Engineering for Data Scientist
Essential Data Engineering for Data Scientist
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2
 
OVHcloud – Enterprise Cloud Databases
OVHcloud – Enterprise Cloud DatabasesOVHcloud – Enterprise Cloud Databases
OVHcloud – Enterprise Cloud Databases
 
Scality S3 Server: Node js Meetup Presentation
Scality S3 Server: Node js Meetup PresentationScality S3 Server: Node js Meetup Presentation
Scality S3 Server: Node js Meetup Presentation
 
Data Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFixData Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFix
 
5 Pitfalls to Avoid with MongoDB
5 Pitfalls to Avoid with MongoDB5 Pitfalls to Avoid with MongoDB
5 Pitfalls to Avoid with MongoDB
 
Big data nyu
Big data nyuBig data nyu
Big data nyu
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive


 
Building a data pipeline to ingest data into Hadoop in minutes using Streamse...
Building a data pipeline to ingest data into Hadoop in minutes using Streamse...Building a data pipeline to ingest data into Hadoop in minutes using Streamse...
Building a data pipeline to ingest data into Hadoop in minutes using Streamse...
 
Logs @ OVHcloud
Logs @ OVHcloudLogs @ OVHcloud
Logs @ OVHcloud
 
Galaxy Big Data with MariaDB
Galaxy Big Data with MariaDBGalaxy Big Data with MariaDB
Galaxy Big Data with MariaDB
 
Timesten Architecture
Timesten ArchitectureTimesten Architecture
Timesten Architecture
 
Greenplum Architecture
Greenplum ArchitectureGreenplum Architecture
Greenplum Architecture
 
Low level java programming
Low level java programmingLow level java programming
Low level java programming
 
Advanced Administration, Monitoring and Backup
Advanced Administration, Monitoring and BackupAdvanced Administration, Monitoring and Backup
Advanced Administration, Monitoring and Backup
 
OS for AI: Elastic Microservices & the Next Gen of ML
OS for AI: Elastic Microservices & the Next Gen of MLOS for AI: Elastic Microservices & the Next Gen of ML
OS for AI: Elastic Microservices & the Next Gen of ML
 
Scylla Summit 2022: Stream Processing with ScyllaDB
Scylla Summit 2022: Stream Processing with ScyllaDBScylla Summit 2022: Stream Processing with ScyllaDB
Scylla Summit 2022: Stream Processing with ScyllaDB
 
Introduction to IBM Spectrum Scale and Its Use in Life Science
Introduction to IBM Spectrum Scale and Its Use in Life ScienceIntroduction to IBM Spectrum Scale and Its Use in Life Science
Introduction to IBM Spectrum Scale and Its Use in Life Science
 

Más de Imperva Incapsula

D3TLV17- You have Incapsula...now what?
D3TLV17- You have Incapsula...now what?D3TLV17- You have Incapsula...now what?
D3TLV17- You have Incapsula...now what?Imperva Incapsula
 
D3TLV17- The Incapsula WAF: Your Best Line of Denfense Against Application La...
D3TLV17- The Incapsula WAF: Your Best Line of Denfense Against Application La...D3TLV17- The Incapsula WAF: Your Best Line of Denfense Against Application La...
D3TLV17- The Incapsula WAF: Your Best Line of Denfense Against Application La...Imperva Incapsula
 
D3TLV17- Advanced DDoS Mitigation Techniques
D3TLV17- Advanced DDoS Mitigation TechniquesD3TLV17- Advanced DDoS Mitigation Techniques
D3TLV17- Advanced DDoS Mitigation TechniquesImperva Incapsula
 
D3LDN17 - Recruiting the Browser
D3LDN17 - Recruiting the BrowserD3LDN17 - Recruiting the Browser
D3LDN17 - Recruiting the BrowserImperva Incapsula
 
D3LDN17 - A Pragmatists Guide to DDoS Mitigation
D3LDN17 - A Pragmatists Guide to DDoS MitigationD3LDN17 - A Pragmatists Guide to DDoS Mitigation
D3LDN17 - A Pragmatists Guide to DDoS MitigationImperva Incapsula
 
D3NY17- Customizing Incapsula to Accommodate Single Sign-On
D3NY17- Customizing Incapsula to Accommodate Single Sign-OnD3NY17- Customizing Incapsula to Accommodate Single Sign-On
D3NY17- Customizing Incapsula to Accommodate Single Sign-OnImperva Incapsula
 
D3NY17 - Migrating to the Cloud
D3NY17 - Migrating to the CloudD3NY17 - Migrating to the Cloud
D3NY17 - Migrating to the CloudImperva Incapsula
 
D3NY17- Using IncapRules to Customize Security
D3NY17- Using IncapRules to Customize SecurityD3NY17- Using IncapRules to Customize Security
D3NY17- Using IncapRules to Customize SecurityImperva Incapsula
 
D3SF17- Using Incap Rules to Customize Your Security and Access Control
D3SF17- Using Incap Rules to Customize Your Security and Access ControlD3SF17- Using Incap Rules to Customize Your Security and Access Control
D3SF17- Using Incap Rules to Customize Your Security and Access ControlImperva Incapsula
 
D3SF17- Boost Your Website Performance with Application Delivery Rules
D3SF17- Boost Your Website Performance with Application Delivery RulesD3SF17- Boost Your Website Performance with Application Delivery Rules
D3SF17- Boost Your Website Performance with Application Delivery RulesImperva Incapsula
 
D3SF17- A Single Source of Truth for Security Issues- Pushing Siem Logs to Cl...
D3SF17- A Single Source of Truth for Security Issues- Pushing Siem Logs to Cl...D3SF17- A Single Source of Truth for Security Issues- Pushing Siem Logs to Cl...
D3SF17- A Single Source of Truth for Security Issues- Pushing Siem Logs to Cl...Imperva Incapsula
 
D3SF17- Improving Our China Clients Performance
D3SF17- Improving Our China Clients PerformanceD3SF17- Improving Our China Clients Performance
D3SF17- Improving Our China Clients PerformanceImperva Incapsula
 
D3SF17- Migrating to the Cloud 5- Years' Worth of Lessons Learned
D3SF17- Migrating to the Cloud 5- Years' Worth of Lessons LearnedD3SF17- Migrating to the Cloud 5- Years' Worth of Lessons Learned
D3SF17- Migrating to the Cloud 5- Years' Worth of Lessons LearnedImperva Incapsula
 
D3SF17 -Keynote - Staying Ahead of the Curve
D3SF17 -Keynote - Staying Ahead of the CurveD3SF17 -Keynote - Staying Ahead of the Curve
D3SF17 -Keynote - Staying Ahead of the CurveImperva Incapsula
 
E-commerce Optimization: Using Load Balancing and CDN to Improve Website Perf...
E-commerce Optimization: Using Load Balancing and CDN to Improve Website Perf...E-commerce Optimization: Using Load Balancing and CDN to Improve Website Perf...
E-commerce Optimization: Using Load Balancing and CDN to Improve Website Perf...Imperva Incapsula
 
Protect Your Assets with Single IP DDoS Protection
Protect Your Assets with Single IP DDoS ProtectionProtect Your Assets with Single IP DDoS Protection
Protect Your Assets with Single IP DDoS ProtectionImperva Incapsula
 
[Webinar] DDoS Pentester Reveals: How Hackers Find Your Website’s Weak Points...
[Webinar] DDoS Pentester Reveals: How Hackers Find Your Website’s Weak Points...[Webinar] DDoS Pentester Reveals: How Hackers Find Your Website’s Weak Points...
[Webinar] DDoS Pentester Reveals: How Hackers Find Your Website’s Weak Points...Imperva Incapsula
 
An Inside Look at a Sophisticated Multi-Vector DDoS Attack
An Inside Look at a Sophisticated Multi-Vector DDoS AttackAn Inside Look at a Sophisticated Multi-Vector DDoS Attack
An Inside Look at a Sophisticated Multi-Vector DDoS AttackImperva Incapsula
 

Más de Imperva Incapsula (20)

D3TLV17- You have Incapsula...now what?
D3TLV17- You have Incapsula...now what?D3TLV17- You have Incapsula...now what?
D3TLV17- You have Incapsula...now what?
 
D3TLV17- Keeping it Safe
D3TLV17-  Keeping it SafeD3TLV17-  Keeping it Safe
D3TLV17- Keeping it Safe
 
D3TLV17- The Incapsula WAF: Your Best Line of Denfense Against Application La...
D3TLV17- The Incapsula WAF: Your Best Line of Denfense Against Application La...D3TLV17- The Incapsula WAF: Your Best Line of Denfense Against Application La...
D3TLV17- The Incapsula WAF: Your Best Line of Denfense Against Application La...
 
D3TLV17- Advanced DDoS Mitigation Techniques
D3TLV17- Advanced DDoS Mitigation TechniquesD3TLV17- Advanced DDoS Mitigation Techniques
D3TLV17- Advanced DDoS Mitigation Techniques
 
D3LDN17 - Recruiting the Browser
D3LDN17 - Recruiting the BrowserD3LDN17 - Recruiting the Browser
D3LDN17 - Recruiting the Browser
 
D3LDN17 - A Pragmatists Guide to DDoS Mitigation
D3LDN17 - A Pragmatists Guide to DDoS MitigationD3LDN17 - A Pragmatists Guide to DDoS Mitigation
D3LDN17 - A Pragmatists Guide to DDoS Mitigation
 
D3LDN17 - Keynote
D3LDN17 - KeynoteD3LDN17 - Keynote
D3LDN17 - Keynote
 
D3NY17- Customizing Incapsula to Accommodate Single Sign-On
D3NY17- Customizing Incapsula to Accommodate Single Sign-OnD3NY17- Customizing Incapsula to Accommodate Single Sign-On
D3NY17- Customizing Incapsula to Accommodate Single Sign-On
 
D3NY17 - Migrating to the Cloud
D3NY17 - Migrating to the CloudD3NY17 - Migrating to the Cloud
D3NY17 - Migrating to the Cloud
 
D3NY17- Using IncapRules to Customize Security
D3NY17- Using IncapRules to Customize SecurityD3NY17- Using IncapRules to Customize Security
D3NY17- Using IncapRules to Customize Security
 
D3SF17- Using Incap Rules to Customize Your Security and Access Control
D3SF17- Using Incap Rules to Customize Your Security and Access ControlD3SF17- Using Incap Rules to Customize Your Security and Access Control
D3SF17- Using Incap Rules to Customize Your Security and Access Control
 
D3SF17- Boost Your Website Performance with Application Delivery Rules
D3SF17- Boost Your Website Performance with Application Delivery RulesD3SF17- Boost Your Website Performance with Application Delivery Rules
D3SF17- Boost Your Website Performance with Application Delivery Rules
 
D3SF17- A Single Source of Truth for Security Issues- Pushing Siem Logs to Cl...
D3SF17- A Single Source of Truth for Security Issues- Pushing Siem Logs to Cl...D3SF17- A Single Source of Truth for Security Issues- Pushing Siem Logs to Cl...
D3SF17- A Single Source of Truth for Security Issues- Pushing Siem Logs to Cl...
 
D3SF17- Improving Our China Clients Performance
D3SF17- Improving Our China Clients PerformanceD3SF17- Improving Our China Clients Performance
D3SF17- Improving Our China Clients Performance
 
D3SF17- Migrating to the Cloud 5- Years' Worth of Lessons Learned
D3SF17- Migrating to the Cloud 5- Years' Worth of Lessons LearnedD3SF17- Migrating to the Cloud 5- Years' Worth of Lessons Learned
D3SF17- Migrating to the Cloud 5- Years' Worth of Lessons Learned
 
D3SF17 -Keynote - Staying Ahead of the Curve
D3SF17 -Keynote - Staying Ahead of the CurveD3SF17 -Keynote - Staying Ahead of the Curve
D3SF17 -Keynote - Staying Ahead of the Curve
 
E-commerce Optimization: Using Load Balancing and CDN to Improve Website Perf...
E-commerce Optimization: Using Load Balancing and CDN to Improve Website Perf...E-commerce Optimization: Using Load Balancing and CDN to Improve Website Perf...
E-commerce Optimization: Using Load Balancing and CDN to Improve Website Perf...
 
Protect Your Assets with Single IP DDoS Protection
Protect Your Assets with Single IP DDoS ProtectionProtect Your Assets with Single IP DDoS Protection
Protect Your Assets with Single IP DDoS Protection
 
[Webinar] DDoS Pentester Reveals: How Hackers Find Your Website’s Weak Points...
[Webinar] DDoS Pentester Reveals: How Hackers Find Your Website’s Weak Points...[Webinar] DDoS Pentester Reveals: How Hackers Find Your Website’s Weak Points...
[Webinar] DDoS Pentester Reveals: How Hackers Find Your Website’s Weak Points...
 
An Inside Look at a Sophisticated Multi-Vector DDoS Attack
An Inside Look at a Sophisticated Multi-Vector DDoS AttackAn Inside Look at a Sophisticated Multi-Vector DDoS Attack
An Inside Look at a Sophisticated Multi-Vector DDoS Attack
 

From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surge2014]

  • 1. From 1000/day to 1000/sec The evolution of our big data system Yoav Cohen VP Engineering
  • 2. This Talk A walk-through of how we built our big-data system Incapsula, Inc. / Proprietary and Confidential. 2 All Rights Reserved.
  • 3. About Incapsula Vendor of a cloud-based Application Delivery Controller Web Application Firewall Incapsula, Inc. / Proprietary and Confidential. 3 All Rights Reserved. Load- Balancing CDN & Optimizer DDoS Protection
  • 4. How does it work? Incapsula, Inc. / Proprietary and Confidential. 4 All Rights Reserved.
  • 5. Modeling Web-Traffic 1. First request to a website starts a new session 2. Subsequent requests are part of the same session 3. After being idle for 30 minutes the session ends Session 1 starts 10:03:01 GET www.incapsula.com/ Session 1 request 1 10:03:10 GET www.incapsula.com/ddos Session 1 request 2 10:03:12 GET www.incapsula.com/cdn … … Session 1 ends Session 2 starts 10.35:05 GET www.incapsula.com/signup Incapsula, Inc. / Proprietary and Confidential. 5 All Rights Reserved.
  • 6. The Data A stream of messages in Google Protobuf format msgTid: 144021710000000001 ype: SESSION_MESSAGE_CREATE siteID: 7 startTime: 1409578192017 clientIP: ****** countryCode: "US" entryUrlID: 5544402418256865164 visitorID: "7e59c804-f663-4595-a0df-35d9b02eb747" userAgent: "Incapsula Site Monitor - OPS" visitorClAppId: 209 … Incapsula, Inc. / Proprietary and Confidential. 6 All Rights Reserved. requestStartTime: 1410004769258 responseStartTime: 1410004769258 responseEndTime: 1410004769261 sessionID: 151009030147748952 urlID: 5544402418256865164 request_id: 567472919066130553 queryString: "" postBody: "" statusCode: 200 serialNumber: 1 content_length: 6350 protocol: HTTP requestResult: REQ_CACHED_FRESH ...
  • 7. The Problem Transforming the stream of messages to readable data • Processing throughput • Read performance • Scalability Incapsula, Inc. / Proprietary and Confidential. 7 All Rights Reserved. ? Session 1 starts Session 1 request 1 Session 1 request 2 … Session 1 ends Session 2 starts …
  • 8. Architecture Incapsula, Inc. / Proprietary and Confidential. 8 All Rights Reserved.
  • 9. Gen 1 2010 – 2011 Incapsula, Inc. / Proprietary and Confidential. 9 All Rights Reserved. Gen 2 2011 – 2013 Gen 3 2013 Gen 4 2015 System Evolution
  • 10. Gen 1: Code Name “rtproc” Incapsula, Inc. / Proprietary and Confidential. 10 All Rights Reserved.
  • 11. Gen 1: OLAP Cube • A text book solution • Time x IP x Country x …  # requests, # attacks, … • Slice and dice to answer any question (how many attack from Germany in Jan-2010?) Incapsula, Inc. / Proprietary and Confidential. 11 All Rights Reserved. dimensions counters select sum(number_of_attacks) from Attacks where site_id=140 and country_code=‘DE’ and time > ‘20100100’ and time < ‘20100200’
  • 12. Gen 1: OLAP Cube • Loading data for individual attacks requires joins: Incapsula, Inc. / Proprietary and Confidential. 12 All Rights Reserved.
  • 13. Gen 1: Analysis • Generic solution • Very big tables • Overly complex (lots of moving parts) Processing Read Scalability Incapsula, Inc. / Proprietary and Confidential. 13 All Rights Reserved.
  • 14. Gen 1 2010 – 2011 Incapsula, Inc. / Proprietary and Confidential. 14 All Rights Reserved. Gen 2 2011 – 2013 Gen 3 2013 Gen 4 2015 System Evolution
  • 15. Gen 2: Code Name “rtprocng” • Main problems to solve: > Read Performance > Simplify • New approach: > Count things on the edge instead of centrally > NoSQL model to improve read performance (no joins) Incapsula, Inc. / Proprietary and Confidential. 15 All Rights Reserved.
  • 16. Gen 2: Simpler Design Incapsula, Inc. / Proprietary and Confidential. 16 All Rights Reserved.
  • 17. Gen 2: Stats NoSQL Storage • One document per day, containing all the data to build the charts • Read performance improved (one lookup for all charts) • Can even load parts of the data (MongoDB feature) Incapsula, Inc. / Proprietary and Confidential. 17 All Rights Reserved. {"_id" : "7_09-04-2014", "pageviews" : [ NumberLong(2369), NumberLong(2380), NumberLong(2520), NumberLong(5651), NumberLong(2912), NumberLong(3357), NumberLong(3723), NumberLong(3301), NumberLong(3092), NumberLong(2984), NumberLong(3791), NumberLong(3069) ], "humsess" : [ NumberLong(213), NumberLong(258), NumberLong(298), …
  • 18. Gen 2: Events NoSQL Storage • One document per session, containing all its actions • Lookups are easy (no joins) • Searches use MongoDB indexes (OK but not great) Incapsula, Inc. / Proprietary and Confidential. 18 All Rights Reserved. { "_id": 226000330131098770, "start": { "$date": "2014-09-09T10:19:00Z" }, "cc": ["CA"], "securityFlags": ["rid4"], "badbot": true, "prxy": [226], "clappt": 1, "actns": [ { "reqRes": 10, "u": "www.incapsula.com/", "attack": [ { "loc": 1, "acode": 0, "act": 7, "rid": 4, "more": 0, "atype": 314, "hidden": false, "match": "", "pval": "" } ...
  • 19. Gen 2: Python Processor • Batch process: > Process the files in the directory for up to X minutes > Flush to storage and exit • How to achieve good processing throughput? > Cache objects in memory > When processing messages, update object in memory > When process finishes, flush all the objects from memory to storage Incapsula, Inc. / Proprietary and Confidential. 19 All Rights Reserved.
  • 20. Gen 2 Storage Bottleneck • Single DB for all sessions • Reality check: > MongoDB coarse-grained locking (lock per DB server) > When batch process flushes, UIs are stuck (lock prefers writes) > Dropping old data impossible > Fragmentation caused excessive disk usage Incapsula, Inc. / Proprietary and Confidential. 20 All Rights Reserved.
  • 21. Gen 2 Storage Re-Factoring • Single DB  DB per day > Drop DBs that are X days old • Live sessions  Live DB “Dead” sessions  per-day DB > 0% fragmentation in per-day DBs > Daily maintenance of Live DB (but it’s relatively small) • DB locking not resolved (later MongoDB versions have lock per DB) Incapsula, Inc. / Proprietary and Confidential. 21 All Rights Reserved.
  • 22. Gen 2: Analysis • Simple and scalable • MongoDB is easy to get started with > Over time TCO increases • Reached batch processing limits Processing Read Scalability Incapsula, Inc. / Proprietary and Confidential. 22 All Rights Reserved.
  • 23. Gen 1 2010 – 2011 Incapsula, Inc. / Proprietary and Confidential. 23 All Rights Reserved. Gen 2 2011 – 2013 Gen 3 2013 Gen 4 2015 System Evolution
  • 24. Gen 3: Code Name “Graceland” • Main problems to solve: > Faster, online processing > Better search capabilities • New approach: > Multi-threaded Java-based processor: - Faster protobuf library than python - Keep objects in memory for longer periods of time and reduce flushes to storage > Lucene for search > A DB we can understand and control Incapsula, Inc. / Proprietary and Confidential. 24 All Rights Reserved.
  • 25. Gen 3: Design Incapsula, Inc. / Proprietary and Confidential. 25 All Rights Reserved.
  • 26. Gen 3: Multi-Threaded Java Processor • One reader thread reads the files and distributes the data between the workers • Workers process the data > Load object from cache > If not in cache, load from storage > Update object > Flush to storage - Periodically - On certain events Incapsula, Inc. / Proprietary and Confidential. 26 All Rights Reserved.
  • 27. Gen 3: Cache Design • Design goal: large cache, but not all in JVM heap • Layered LRU cache (extends LinkedHashMap) • One layer is the map, backing layer on tmpfs or disk Incapsula, Inc. / Proprietary and Confidential. 27 All Rights Reserved.
  • 28. Gen 3 Stats Storage (“Segmented Storage”) • Binary file per day • Keep recent files separate, archive older files 2014-02-03 2014-02-03.pbz 0 14325654845 2014-02-02 2014-02-02.pbz 0 14326542128 2014-02-01 2014-02-03.pbz 0 14325654845 2014-01-31 archive.pbz 76515 14325654845 ... 2014-01-01 archive.pbz 0 14365428845 Incapsula, Inc. / Proprietary and Confidential. 28 All Rights Reserved.
  • 29. Gen 3 Stats Storage (Segmented Storage) • Files are served via nginx • Clients keep cache Incapsula, Inc. / Proprietary and Confidential. 29 All Rights Reserved.
  • 30. Gen 3 Events Storage • Tried different DBs: > LevelDB, KyotoCabinet - Storing the raw session data inside the lucene index - Index memory footprint grew (all the session data got memory-mapped) > LevelDB, KyotoCabinet - Couldn’t get these to work reliably > Cassandra - Rule of thumb: if your DB has its own conference, you need a DBA - We felt it’s easier to write our own than read the docs Incapsula, Inc. / Proprietary and Confidential. 30 All Rights Reserved.
  • 31. Gen 3 Events Storage (“Indexing Partition”) • A partition (directory) per-day, containing: > Lucene index of sessions > Big file with sessions in it • Same approach as in Gen 2 for live sessions: > Live sessions  Live partition > Dead sessions  per-day partitions > 0% fragmentation > Complicates searching a bit > Live partitions require cleanup or re-building Incapsula, Inc. / Proprietary and Confidential. 31 All Rights Reserved.
  • 32. Gen 3 Events Storage (“Indexing Partition”) • Searches are more efficient: > Search requests are served directly from index > Session data is loaded only on-demand, and via nginx using HTTP Range header Incapsula, Inc. / Proprietary and Confidential. 32 All Rights Reserved.
  • 33. Gen 3: Analysis • Good processing throughput • Good read performance • Reaching JVM issues (big heap) Processing Read Scalability Incapsula, Inc. / Proprietary and Confidential. 33 All Rights Reserved.
  • 34. Gen 1 2010 – 2011 Incapsula, Inc. / Proprietary and Confidential. 34 All Rights Reserved. Gen 2 2011 – 2013 Gen 3 2013 Gen 4 2015 System Evolution
  • 35. Gen 4: 2015 • Based on Gen 3 • Distribute work to more than one system > One data server in each POP (> 20 POPs) > Each POP processes and stores its own data > Upload processed outputs to central servers or search on all POP servers Incapsula, Inc. / Proprietary and Confidential. 35 All Rights Reserved.
  • 36. Summary • It is equally important to understand how your system works as it is to understand every other aspect of your business • At some point we realized it’s better for us to build our software from scratch than use off the shelves products as black-boxes: > We need to find people who know the products - Which is crazy since we tried tons of them over the last 4 years > We usually have less requirements - Who needs multi-DC replication since day 1? > We prefer coding it than reading documentations and stackoverflows - Then we can hack it in the middle of the night if needed - It’s way more fun (at least for the developers…) Incapsula, Inc. / Proprietary and Confidential. 36 All Rights Reserved.
  • 37. Questions? Incapsula, Inc. / Proprietary and Confidential. 37 All Rights Reserved.
  • 38. Types of Data Statistics – just numbers, used for charts, billing, etc. Incapsula, Inc. / Proprietary and Confidential. 38 All Rights Reserved.
  • 39. Types of Data Events – in-depth information, used for forensics and research Incapsula, Inc. / Proprietary and Confidential. 39 All Rights Reserved.

Notas del editor

  1. Click to edit Master text styles Second level Third level Fourth level Fifth level
  2. Click to edit Master text styles Second level Third level Fourth level Fifth level
  3. Click to edit Master text styles Second level Third level Fourth level Fifth level
  4. Click to edit Master text styles Second level Third level Fourth level Fifth level
  5. Click to edit Master text styles Second level Third level Fourth level Fifth level
  6. Click to edit Master text styles Second level Third level Fourth level Fifth level
  7. Click to edit Master text styles Second level Third level Fourth level Fifth level
  8. Click to edit Master text styles Second level Third level Fourth level Fifth level
  9. Click to edit Master text styles Second level Third level Fourth level Fifth level