Advanced Problems in Cloud Computing Dipl.-Wirt.-Inform. Robert Neumann
0. General Reengineering Performance enhancements - Minimize roundtrips between separate systems - Write efficient algorithms - Use data types effectively - Make smart memory-cpu trade-off decisions - Avoid complex computations, when rendering query results 321
1. Secondary Indexing What for? - PK and RK are indexed fast access - Other entity properties are not indexed query runs over all entities Concept - An ordered index on properties that are neither PK nor RK -How? - Store secondary entity that has property that is to be indexed as PK 322
1. Secondary Indexing - Models Original entity 1. Pivoting Property with PK, maintain other properties - Pros: - One roundtrip to serve one query - Cons: - Redundant data storage (twice as much) 323
1. Secondary Indexing - Models Original entity 2. Pivoting Property with PK only - Pros: - Minimizes redundant data storage - Cons: - Two roundtrips to serve one query 324
1. Secondary Indexing -Example (primary index) E=(PK, RK, {P}) E=( New York, Central Park, {P}) 325
1. Secondary Indexing Example (secondary index) E=(PK, RK, {P}) E=( Central, 1, {P}) E=( Central Park, 1, {P}) To differentiate multiple entities for the same search term 326
2. High-speed Content Provisioning Medium Performance Consistent Persistent Azure Fast Yes No Membase Fast Yes Yes/No IIS cache Fast No No Table Storage/ SQL Azure Slow Yes Yes ASP.Net Profiles Slow Yes Yes Session State (Table/SQL) Slow Yes Yes/No Cookies Medium Yes/No No! Yes/No No! 327
2. High-speed Content Provisioning Table Storage - Good for Look-up Query Operations - Supported - Comparators (e.g., >, <, >=, <=, ==) - Not supported - Contains (e.g., Like ) 328
2. High-speed Content Provisioning Page-view Life cycle data 1. Volatile data Always-up-to-date business data Requires immediate consistency 2. Periodically volatile data Data that can be presented with delay Allows for eventual consistency 3. Non-volatile data Static data does not change over time Is repeatedly require to render queries 329
2. High-speed Content Provisioning - Example ServiceParrot Data Volatile Periodically volatile Non-volatile New Location X X - Updated Location X X - Top5/Latest5 X X - User Count - X - Location Count Feedback Count - X - - X - 330
2. High-speed Content Provisioning - Storage Using caches Volume Volatile Periodically volatile High Table Distributed Non-volatile Distributed Low Table IIS IIS Performance Hierarchy 1. IIS (Client Instance Client) 2. Distributed (Client Instance Instance Client) 3. Table Storage (Client Instance Table Instance Client) Trespasses no system boundary (inside the cloud)! Trespass at least one system boundary (inside the cloud)! 331
2. High-speed Content Provisioning - Example ServiceParrot Data Volatile Periodically volatile Non-volatile New Location X (Table) X (A-) - Updated Location X (Table) X (A-) - Top5/Latest5 X (Table) X () - User Count - X () - Location Count Feedback Count - X () - - X () - Volume High High Low Low Low Low Hit rate and size of cacheable data important! (very expensive resource!) 332
2. High-speed Content Provisioning - Example ServiceParrot Data Volatile Periodically volatile Non-volatile New Location X (Table) X (A-) - Updated Location X (Table) X (A-) - Top5/Latest5 X (Table) X () - User Count - X () - Location Count Feedback Count - X () - - X () - Volume High High Low Low Low Low Very promising: avoids one Table Storage roundtrip each! 333
2. High-speed Content Provisioning Periodic Volatility Strict consistency with Table Storage Request Response -Locations -Feedbacks -UserCount -LocationCount Browser IIS Table Storage 334
2. High-speed Content Provisioning Periodic Volatility Eventual Consistency with IIS Request Response -Locations -Feedbacks -UserCount -LocationCount Browser IIS LastUpdate >= 15Min Table Storage 335
2. High-speed Content Provisioning Periodic Volatility Eventual Consistency with IIS Instance 1 Instance 2 Instance 3 Table Storage UserCount = 1 336
2. High-speed Content Provisioning Periodic Volatility Eventual Consistency with IIS Startup (T=0) Instance 1 Instance 2 Instance 3 UserCount = 1 UserCount = 1 UserCount = 1 Table Storage UserCount = 1 337
2. High-speed Content Provisioning Periodic Volatility Eventual Consistency with IIS Startup (T=5) Instance 1 Instance 2 Instance 3 UserCount = 1 UserCount = 1 UserCount = 1 Table Storage UserCount = 1 338
2. High-speed Content Provisioning Periodic Volatility Eventual Consistency with IIS Startup (T=10) Instance 1 Instance 2 Instance 3 UserCount = 1 UserCount = 1 UserCount = 1 Table Storage UserCount = 1 339
2. High-speed Content Provisioning Periodic Volatility Eventual Consistency with IIS Startup (T=14) Instance 1 Instance 2 Instance 3 UserCount = 1 UserCount = 1 UserCount = 1 Table Storage UserCount = 2 340
2. High-speed Content Provisioning Periodic Volatility Eventual Consistency with IIS Startup (T=15) Instance 1 Instance 2 Instance 3 UserCount = 1 UserCount = 1 UserCount = 2 Table Storage UserCount = 2 341
2. High-speed Content Provisioning Periodic Volatility Eventual Consistency with IIS Startup (T=20) Instance 1 Instance 2 Instance 3 UserCount = 2 UserCount = 1 UserCount = 2 Table Storage UserCount = 2 342
2. High-speed Content Provisioning Periodic Volatility Eventual Consistency with IIS Startup (T=25) Instance 1 Instance 2 Instance 3 UserCount = 2 UserCount = 2 UserCount = 2 Table Storage UserCount = 2 343
2. High-speed Content Provisioning Periodic Volatility Eventual Consistency with IIS and Distributed Request -Locations -Feedbacks Response -UserCount -LocationCount D- Clocks can differ up to 1 minute in the Azure cloud D- Browser IIS LastUpdate >= 15Min LastUpdate >= 15Min Table Storage 344
3. Azure Native Azure Instance - Windows Server 2008 R2 Full Trust and Native Code in Azure <WebRole name= WebRole enablenativecodeexecution= true > <InputEndpoints> <InputEndpoint name = HttpIn protocol= http port= 80 /> </InputEndpoints> </WebRole> 345
3. Azure Native Possibilities Languages/Platforms - Java: JBoss, Tomcat - Python - Ruby: RoR - PHP - Etc. Bind to Port 80? No, as IIS is already bound! Applications - Membase, Cassandra, Mongo DB - Sharepoint - Etc. 346
3. Azure Native CGI Common Gateway Interface (CGI) - Execute code on incoming requests - (create new process (e.g., Perl) and pipe to standard input) - Return response to user -Disadvantages - Heavy-weight CGI processes - Process creation is big drag on performance - Multiple running processes (uncontrolled) high memory consumption 347
3. Azure Native CGI in-process 1. In-process module Web server loads library into its address space Web server forwards incoming code to library No expensive process start-up/tear-down ISAPI (IIS), mod_perl/mod_php (Apache) 348
3. Azure Native Fast CGI 2. Fast CGI Web server communicates to special FastCGI process FastCGI process hosts language runtime Advantages Seperate process Isolated from web server (security, stability) Long-lived No proces start-up/tear-down overhead Open standard 349
3. Azure Native Fast CGI in Azure 1. Enable FastCGI mode Add Web.roleconfig to project root folder Web.roleconfig contains: <?xml version= 1.0 encoding= utf-8?> <configuration> <system.webserver> <fastcgi> <application fullpath= %RoleRoot%\fast-cgibinary.exe /> </fastcgi> </system.webserver> </configuration> 350
3. Azure Native Fast CGI in Azure 2. Map file type to FastCGI (in web.config!) Add Web.roleconfig to project root folder Web.config contains: <configuration> <system.webserver> <handlers> <add name= My FastCGI implementation path= *.fastcgi verb= * modules= FastCgiModule scriptprocessor= %RoleRoot%\fast-cgi-binary.exe resourcetype= Unspecified /> </handlers> </system.webserver> </configuration> 351
3. Azure Native Fast CGI in Azure 3. Alternatively Instead of step 1 & 2 Create CGI WebRole 352
3. Azure Native PHP in Azure Steps 1. Download latest PHP distribution 2. Add new folder to project (e.g., php ) 3. Unpack PHP zip into php project folder 4. In ServiceConfiguration.csdef 1. enablenativecodeexecution= true 5. In Web.roleconfig 1. <application fullpath= %RoleRoot%\php\php-cgi.exe /> 6. In web.config 1. <add name= My PHP processor path= *.php verb= * modules= FastCgiModule scriptprocessor= %RoleRoot%\php\php-cgi.exe resourcetype= Unspecified /> 353
3. Azure Native PHP in Azure Test <?php phpinfo();?> PHP/Azure Storage - Check: phpazure.codeplex.com 354
4. Secure Backup in the Cloud Compressions 1. Write tables into one big file and compress? 2. Write tables into many smaller files and compress? Achieves higher compression rates! Download Azure Backup from: http://github.com/sriramk/azbackup 355
4. Secure Backup in the Cloud - Security Security Level - Data is secure, even if three-letter government agencies wanted to get it - Secrecy - Data must not be in the clear, neither in motion nor at rest - Integrity - Ability to find out whether data has been tampered with - Ability to verify tools - Only trust code you can see in any layer charged with enforcing Secrecy or Integrity 356
4. Secure Backup in the Cloud Data in Motion Protecting Data in Motion - Secure Sockets Layer (SSL) - Transport Layer Security (TSL) see Cloud Frontends lecture Authenticating clients - Cryptographic hashes - Client and server agree on a security salt - Client generates hash over HTTP query and adds it to URL - Server compares client s hash with his own hash 357
4. Secure Backup in the Cloud Data at Rest Protecting Data at Rest - Cloud providers are having various security practices to protect data Additional means of protection necessary for: - Highly sensitive data - Data for which laws and regulations apply - Corporate compliance models 358
4. Secure Backup in the Cloud Encryption Symmetric - E.g., Advanced Encryption Standard (AES) = Rijndael - Advantage - Fast! - Disadvantage - Both parties need to know secret key Asymmetric - Private and public key - Advantage - Everybody can encrypt cypher with public key - Only receiver can decrypt cypher with private key - Disadvantage - Slow! 359
Resources -http://blogs.msdn.com/b/hsirtl/ 360