Distributed TensorFlow and the hidden layers of engineering work

By Brad Svee, Staff Cloud Solutions Architect

With all the buzz around Machine Learning as of late, it’s no surprise that companies are starting to experiment with their own ML models, and a lot of them are choosing TensorFlow. Because TensorFlow is open source, you can run it locally to quickly create prototypes and deploy fail-fast experiments that help you get your proof-of-concept working at a small scale. Then, when you’re ready, you can take TensorFlow, your data, and the same code and push it up into Google Cloud to take advantage of multiple CPUs, GPUs or soon even some TPUs.

When you get to the point where you’re ready to take your ML work to the next level, you will have to make some choices about how to set up your infrastructure. In general, many of these choices will impact how much time you spend on operational engineering work versus ML engineering work. To help, we’ve published a pair of solution tutorials to show you how you can create and run a distributed TensorFlow cluster on Google Compute Engine and run the same code to train the same model on Google Cloud Machine Learning Engine. The solutions use MNIST as the model, which isn’t necessarily the most exciting example to work with, but does allow us to emphasize the engineering aspects of the solutions.

We’ve already talked about the open-source nature of TensorFlow, allowing you to run it on your laptop, on a server in your private data center, or even a Raspberry PI. TensorFlow can also run in a distributed cluster, allowing you divide your training workloads across multiple machines, which can save you a significant amount of time waiting for results. The first solution shows you how to set up a group of Compute Engine instances running TensorFlow, as in Figure 1, by creating a reusable custom image, and executing an initiation script with Cloud Shell. There are quite a few steps involved in creating the environment and getting it to function properly. Even though they aren’t complex steps, they are operational engineering steps, and will take time away from your actual ML development.

Figure 1. A distributed TensorFlow cluster on Google Compute Engine.

The second solution uses the same code with Cloud ML Engine, and with one command you’ll automatically provision the compute resources needed to train your model. This solution also delves into some of the general details of neural networks and distributed training. It also gives you a chance to try out TensorBoard to visualize your training and resulting model as seen in Figure 2. The time you save provisioning compute resources can be spent analyzing your ML work more deeply.

Figure 2. Visualizing the training result with TensorBoard.

Regardless of how you train your model, the whole point is you want to use it to make predictions. Traditionally, this is where the most engineering work has to be done. In the case where you want to build a web-service to run your predictions, at a minimum, you’ll have to provision, configure and secure some web servers, load balancers, monitoring agents, and create some kind of versioning process. In both of these solutions, you’ll use the Cloud ML Engine prediction service to effectively offload all of those operational tasks to host your model in a reliable, scalable, and secure environment. Once you set up your model for predictions, you’ll quickly spin up a Cloud Datalab instance and download a simple notebook to execute and test the predictions. In this notebook you’ll draw a number with your mouse or trackpad, as in Figure 3, which will get converted to the appropriate image matrix format that matches the MNIST data format. The notebook will send your image to your new prediction API and tell you which number it detected as in Figure 4.

Figure 3.

Figure 4.

This brings up one last and critical point about the engineering efforts required to host your model for predictions, which is not deeply expanded upon in these solutions, but is something that Cloud ML Engine and Cloud Dataflow can easily address for you. When working with pre-built machine learning models that work on standard datasets, it can be easy to lose track of the fact that machine learning model training, deployment, and prediction are often at the end of a series of data pipelines. In the real world, it’s unlikely that your datasets will be pristine and collected specifically for the purpose of learning from the data.

Rather, you’ll usually have to preprocess the data before you can feed it into your TensorFlow model. Common preprocessing steps include de-duplication, scaling/transforming data values, creating vocabularies, and handling unusual situations. The TensorFlow model is then trained on the clean, processed data.

At prediction time, it is the same raw data that will be received from the client. Yet, your TensorFlow model has been trained with de-duplicated, transformed, and cleaned-up data with specific vocabulary mappings. Because your prediction infrastructure might not be written in Python, there is a significant amount of engineering work necessary to build libraries to carry out these tasks with exacting consistency in whatever language or system you use. Many times there is too much inconsistency in how the preprocessing is done before training versus how it’s done before prediction. Even the smallest amount of inconsistency can cause your predictions to behave poorly or unexpectedly. By using Cloud Dataflow to do the preprocessing and Cloud ML Engine to carry out the predictions, it’s possible to minimize or completely avoid this additional engineering work. This is because Cloud Dataflow can apply the same preprocessing transformation code to both historical data during training and real-time data during prediction.

Summary 
Developing new machine learning models is getting easier as TensorFlow adds new APIs and abstraction layers and allows you to run it wherever you want. Cloud Machine Learning Engine is powered by TensorFlow so you aren’t locked into a proprietary managed service, and we’ll even show you how to build your own TensorFlow cluster on Compute Engine if you want. But we think that you might want to spend less time on the engineering work needed to set up your training and prediction environments, and more time tuning, analyzing and perfecting your model. With Cloud Machine Learning Engine, Cloud Datalab, and Cloud Dataflow you can optimize your time. Offload the operational engineering work to us, quickly and easily analyze and visualize your data, and build preprocessing pipelines that are reusable for training and prediction.
Quelle: Google Cloud Platform

How to analyze Fastly real-time streaming logs with BigQuery

By Simon Wistow VP of Product Strategy, Fastly

[Editor’s note: Today we hear from Fastly, whose edge cloud platform allows web applications to better serve global users with services for content delivery, streaming, security and load-balancing. In addition to improving response times for applications built on Google Cloud Platform (GCP), Fastly now supports streaming its logs to Google Cloud Storage and BigQuery, for deeper analysis. Read on to learn more about the integration and how to set it up in your environment.] 

Fastly’s collaboration with Google Cloud combines the power of GCP with the speed and flexibility of the Fastly edge cloud platform. Private interconnects with Google at 14 strategic locations across the globe give GCP and Fastly customers dramatically improved response times to Google services and storage for traffic going over these interconnects.

Today, we’ve announced our BigQuery integration; we can now stream real-time logs to Google Cloud Storage and BigQuery, allowing companies to analyze unlimited amounts of edge data. If you’re a Fastly customer, you can get actionable insights into website page views per month and usage by demographic, geographic location and other dimensions. You can use this data to troubleshoot connectivity problems, pinpoint configuration areas that need performance tuning, identify the causes of service disruptions and improve your end users’ experience. You can even combine Fastly log data with other data sources such as Google Analytics, Google Ads data and/or security and firewall logs using a BigQuery table. You can save Fastly’s real-time logs to Cloud Storage for additional redundancy; in fact, many customers back up logs directly into Cloud Storage from Fastly.

A Fastly POP fronts a GCP-based application, and streams its logs to BigQuery

Let’s look at how to set up and start using Cloud Storage and BigQuery to analyze Fastly logs.

Fastly / BigQuery quick setup 

Before adding BigQuery as a logging endpoint for Fastly services, you need to register for a Cloud Storage account and create a Cloud Storage bucket. Once you’ve done that, follow these steps to integrate with Fastly.

Create a Google Cloud service account
BigQuery uses service accounts for third-party application authentication. To create a new service account, see Google’s guide on generating service account credentials. When you create the service account, set the key type to JSON.  

Obtain the private key and client email
Once you’ve created the service account, download the service account JSON file. This file contains the credentials for your BigQuery service account. Open the file and make a note of the private_key and client_email.

Enable the BigQuery API (if not already enabled)
To send your Fastly logs to your Cloud Storage bucket, you’ll need to enable the BigQuery API in the GCP API Manager. 

Create the BigQuery dataset
After you’ve enabled the BigQuery API, follow these instructions to create a BigQuery dataset:

Log in to BigQuery.
Click the arrow next to your account name on the sidebar and select Create new dataset.

The Create Dataset window appears.
In the Dataset ID field, type a name for the dataset (e.g., fastly_bigquery), and click the OK button. 

Add a BigQuery table
After you’ve created the BigQuery dataset, you’ll need to add a BigQuery table. There are three ways of creating the schema for the table:

Edit the schema using the BigQuery web interface
Edit the schema using the text field in the BigQuery web interface
Use an existing table

We recommend creating a new table and creating the schema using the user interface. However, you can also edit a text-based representation of the table schema. In fact, you can switch between the text version and the UI at any time. For your convenience, at the bottom of this blogpost we’ve included an example of the logging format to use in the Fastly user interface and the corresponding BigQuery schema in text format. Note: It’s important that the data you send to BigQuery from Fastly matches the schema for the table, or it could result in the data being corrupted or just silently being dropped.
As per the BigQuery documentation, click the arrow next to the dataset name on the sidebar and select Create new table.

The Create Table page appears:

In the Source Data section, select Create empty table.
In the Table name field, type a name for the table (e.g., logs).
In the Schema section of the BigQuery website, use the interface to add fields and complete the schema. Click the Create Table button.

Add BigQuery as a logging endpoint
Follow these instructions to add BigQuery as a logging endpoint:

Review the information in our Setting Up Remote Log Streaming guide.
Click the BigQuery logo. The Create a BigQuery endpoint page appears:

Fill out the Create a BigQuery endpoint fields as follows:

In the Name field, supply a human-readable endpoint name.
In the Log format field, enter the data to send to BigQuery. See the example format section for details.
In the Email field, type the client_email address associated with the BigQuery account.
In the Secret key field, type the secret key associated with the BigQuery account.
In the Project ID field, type the ID of your GCP project.
In the Dataset field, type the name of your BigQuery dataset.
In the Table field, type the name of your BigQuery table.
In the Template field, optionally type an strftime compatible string to use as the template suffix for your table.

Click Create to create the new logging endpoint.
Click the Activate button to deploy your configuration changes. 

Formatting JSON objects to send to BigQuery 
The data you send to BigQuery must be serialized as a JSON object, and every field in the JSON object must map to a string in your table’s schema. The JSON can have nested data in it (e.g., the value of a key in your object can be another object). Here’s an example format string for sending data to BigQuery:
{
“timestamp”:”%{begin:%Y-%m-%dT%H:%M:%S%z}t”,
“time_elapsed”:%{time.elapsed.usec}V,
“is_tls”:%{if(req.is_ssl, “true”, “false”)}V,
“client_ip”:”%{req.http.Fastly-Client-IP}V”,
“geo_city”:”%{client.geo.city}V”,
“geo_country_code”:”%{client.geo.country_code}V”,
“request”:”%{req.request}V”,
“host”:”%{req.http.Fastly-Orig-Host}V”,
“url”:”%{cstr_escape(req.url)}V”,
“request_referer”:”%{cstr_escape(req.http.Referer)}V”,
“request_user_agent”:”%{cstr_escape(req.http.User-Agent)}V”,
“request_accept_language”:”%{cstr_escape(req.http.Accept-Language)}V”,
“request_accept_charset”:”%{cstr_escape(req.http.Accept-Charset)}V”,
“cache_status”:”%{regsub(fastly_info.state, “^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*”, “23”) }V”
}

Example BigQuery schema 
The textual BigQuery schema for the example format shown above would look something like this:

timestamp:STRING,time_elapsed:FLOAT,is_tls:BOOLEAN,client_ip:STRING,geo_city:STRING,geo_co
untry_code:STRING,request:STRING,host:STRING,url:STRING,request_referer:STRING,request_use
r_agent:STRING,request_accept_language:STRING,request_accept_charset:STRING,cache_status:S
TRING
When creating your BigQuery table, click on the “Edit as Text” link and paste this example in.

Get started now
Congratulations! You’ve just configured Fastly to send its logs in real time to Cloud Storage and BigQuery, where you can easily analyze them to better understand how users are interacting with your applications. Please contact us with any questions. If you’re a current customer, we’d love to hear about how you’re using Fastly and GCP. And if you’re new to Fastly, you can try it out for free; simply sign up here to get going.

Quelle: Google Cloud Platform

How to build a conversational app using Cloud Machine Learning APIs, Part 2

By Chang Luo and Bob Liu, Software Engineers

In part 1 of this blogpost, we gave you an overview of what a conversational tour guide iOS app might look like built on Cloud Machine Learning APIs and API.AI. We also demonstrated how to create API.AI intents and contexts. In part 2, we’ll discuss an advanced API.AI topic — webhook with Cloud Functions. We’ll also show you how to use Cloud Machine Learning APIs (Vision, Speech and Translation) and how to support a second language.

Webhooks via Cloud Functions 
In API.AI, Webhook integrations allow you to pass information from a matched intent into a web service and get a result from it. Read on to learn how to request parade info from Cloud Functions.

Go to console.cloud.google.com. Log in with your own account and create a new project. 

Once you’ve created a new project, navigate to that project. 
Enable the Cloud Functions API. 

Create a function. For the purposes of this guide, we’ll call the function “parades”. Select the “HTTP” trigger option, then select “inline” editor. 

Don’t forget to specify the function to execute to “parades”.

You’ll also need to create a “stage bucket”. Click on “browse” — you’ll see the browser, but no buckets will exist yet. 

Click on the “+” button to create the bucket.

Specify a unique name for the bucket (you can use your project name, for instance), select “regional” storage and keep the default region (us-central1).
Click back on the “select” button in the previous window.
Click the “create” button to create the function.

The function will be created and deployed: 

Click the “parades” function line. In the “source” tab, you’ll see the sources. 

Now it’s time to code our function! We’ll need two files: the “index.js” file will contain the JavaScript / Node.JS logic, and the “package.json” file contains the Node package definition, including the dependencies we’ll need in our function.

Here’s our package.json file. This is dependent on the actions-on-google NPM module to ease the integration with API.AI and the Actions on Google platform that allows you to extend the Google Assistant with your own extensions (usable from Google Home):

{
“name”: “parades”,
“version”: “0.0.1”,
“main”: “index.js”,
“dependencies”: {
“actions-on-google”: “^1.1.1″
}
}

In the index.js file, here’s our code:

const ApiAiApp = require(‘actions-on-google’).ApiAiApp;
function parade(app) {
app.ask(`Chinese New Year Parade in Chinatown from 6pm to 9pm.`);
}
exports.parades = function(request, response) {
var app = new ApiAiApp({request: request, response: response});
var actionMap = new Map();
actionMap.set(“inquiry.parades”, parade);
app.handleRequest(actionMap);
};

In the code snippets above: 

We require the actions-on-google NPM module. 
We use the ask() method to let the assistant send a result back to the user. 
We export a function where we’re using the actions-on-google module’s ApiAiApp class to handle the incoming request. 
We create a map that maps “intents” from API.AI to a JavaScript function. 
Then, we call the handleRequest() to handle the request. 
Once done, don’t forget to click the “create” function button. It will deploy the function in the cloud. 

There’s subtle difference between tell() and ask() APIs. tell() will end the conversation and close the mic, while ask() will not. This difference doesn’t matter for API.AI projects like the one we demonstrate here in part 1 and part 2 of this blogpost. When we integrate Actions on Google in part 3, we’ll explain this difference in more detail. 

As shown below, the “testing” tab invokes your function, the “general” tab shows statistics and the “trigger” tab reveals the HTTP URL created for your function: 

Your final step is to go to the API.AI console, then click the Fulfillment tab. Enable webhook and paste the URL above into the URL field. 

With API.AI, we’ve built a chatbot that can converse with a human by text. Next, let’s give the bot “ears” to listen with Cloud Speech API, “eyes” to see with Cloud Vision API, a “mouth” to talk with the iOS text-to-speech SDK and “brains” for translating languages with Cloud Translation API.

Using Cloud Speech API 

Cloud Speech API includes an iOS sample app. It’s quite straightforward to integrate the gRPC non-streaming sample app into our chatbot app. You’ll need to acquire an API key from Google Cloud Console and replace this line in SpeechRecognitionService.m with your API key.

#define API_KEY @”YOUR_API_KEY”

Landmark detection 
NSDictionary *paramsDictionary =
@{@”requests”:@[
@{@”image”:
@{@”content”:binaryImageData},
@”features”:@[
@{@”type”:@”LANDMARK_DETECTION”, @”maxResults”:@1}]}]};

Follow this example to use Cloud Vision API on iOS. You’ll need to replace the label and face detection with landmark detection as shown below. 

You can use the same API key you used for Cloud Speech API. 

Text to speech
iOS 7+ has a built-in text-to-speech SDK, AVSpeechSynthesizer. The code below is all you need to convert text to speech.

#import
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:message];
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
[synthesizer speakUtterance:utterance];

Supporting multiple languages

Supporting additional languages in Cloud Speech API is a one-line change on the iOS client side. (Currently, there’s no support for mixed languages.) For Chinese, replace this line in SpeechRecognitionService.m: 

recognitionConfig.languageCode = @”en-US”;
with

recognitionConfig.languageCode = @”zh-Hans”;

To support additional text-to-speech languages, add this line to the code:

#import
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:message];
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@”zh-Hans”];
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
[synthesizer speakUtterance:utterance];
Both Cloud Speech API and Apple’s AVSpeechSynthesisVoice support BCP-47 language code.

Cloud Vision API landmark detection currently only supports English, so you’ll need to use the Cloud Translation API to translate to your desired language after receiving the English-language landmark description. (You would use Cloud Translation API similarly to Cloud Vision and Speech APIs.) 

On the API.AI side, you’ll need to create a new agent and set its language to Chinese. One agent can support only one language. If you try to use the same agent for a second language, machine learning won’t work for that language. 

You’ll also need to create all intents and entities in Chinese. 

And you’re done! You’ve just built a simple “tour guide” chatbot that supports English and Chinese.

Next time 

We hope this example has demonstrated how simple it is to build an app powered by machine learning. For more getting-started info, you might also want to try:

Cloud Speech API Quickstart 
Cloud Vision API Quickstart 
Cloud Translation API Quickstart 
API.AI QuickstartY

You can download the source code from Github.

In part 3, we’ll cover how to build this app on Google Assistant with Actions on Google integration.

Quelle: Google Cloud Platform

Cloud Speech API improves longform audio recognition and adds 30 new language variants

By Dan Aharon, Product Manager

Since its launch in 2016, businesses have used the Google Cloud Speech API to improve speech recognition for everything from voice-activated commands to call center routing to data analytics. And since then, we’ve gotten a lot of feedback that our users would like even more functionality and control. That’s why today we’re announcing Cloud Speech API features that expand support for long-form audio and further extend our language support to help even more customers inject AI into their businesses.

Here’s more on what the updated Cloud Speech API can do:

Word-level timestamps
Our number one most requested feature has been providing timestamp information for each word in the transcript. Word-level timestamps let users jump to the moment in the audio where the text was spoken, or display the relevant text while the audio is playing. You can find more information on timestamps here.

Happy Scribe uses Cloud Speech API to power its easy-to-use and affordable voice-to-text transcription service, helping professionals such as reporters and researchers transcribe interviews.

“Having the ability to map the audio to the text with timestamps significantly reduces the time spent proofreading transcripts.”  

— Happy Scribe Co-founder, André Bastie
VoxImplant enables companies to build voice and video applications, including IVR and speech analytics applications.

“Now with Google Cloud Speech API timestamps, we can accurately analyze phone call conversations between two individuals with real-time speech-to-text transcription, helping our customers drive business impact. The ability to easily find the place in a call when something was said using timestamps makes Cloud Speech API much more useful and will save our customers’ time”  

— VoxImplant CEO, Alexey Aylarov

Support for files up to 3 hours long
To help our users with long-form audio needs, we’re increasing the length of supported files from 80 minutes to up to 3 hours. Additionally, files longer than 3 hours could be supported on a case-by-case basis by applying for a quota extension through Cloud Support.

Expanded language coverage
Cloud Speech API already supports 89 language varieties. Today, coinciding with the broader announcement this morning, we’re adding 30 additional language varieties, from Bengali to Latvian to Swahili, covering more than one billion additional speakers. Our new expanded language support helps Cloud Speech API customers reach more users in more countries for an almost global reach. In addition, it enables users in more countries to use speech to access products and services that up until now have never been available to them.

You can find our complete list of supported languages here.

We hope these updates will help our users do more with Cloud Speech API. To learn more, visit Cloud.google.com/speech/.
Quelle: Google Cloud Platform

CRE life lessons: The practicalities of dark launching

By Adrian Hilton, Customer Reliability Engineer

In the first part of this series, we introduced you to the concept of dark launches. In a dark launch, you take a copy of your incoming traffic and send it to the new service, then throw away the result. Dark launches are useful when you want to launch a new version of an existing service, but don’t want nasty surprises when you turn it on.

This isn’t always straightforward as it sounds, however. In this blog post, we’ll look at some of the circumstances that can make things difficult for you, and teach you how to work around them.

Finding a traffic source
Do you actually have existing traffic for your service? If you’re launching a new web service which is not more-or-less-directly replacing an existing service, you may not.

As an example, say you’re an online catalog company that lets users browse items from your physical store’s inventory. The system is working well, but now you want to give users the ability to purchase one of those items. How would you do a dark launch of this feature? How can you approximate real usage when no user is even seeing the option to purchase an item?

One approach is to fire off a dark-launch query to your new component for every user query to the original component. In our example, we might send a background “purchase” request for an item whenever the user sends a “view” request for that item. Realistically, not every user who views an item will go on to purchase it, so we might randomize the dark launch by only sending a “purchase” request for one in every five views.

This will hopefully give you an approximation of live traffic in terms of volume and pattern. Note that this can’t be expected to be totally accurate when it comes to to live traffic when the service is launched. But, it’s better than nothing.

Dark launching mutating services
Generally, a read-only service is fairly easy to dark-launch. A service with queries that mutate backend storage is far less easy. There are still strong reasons for doing the dark launch in this situation, because it gives you some degree of testing that you can’t reasonably get elsewhere, but you’ll need to invest significant effort to get the most from dark-launching.

Unless you’re doing a storage migration, you’ll need to make significant effort/payoff tradeoffs doing dark launches for mutating queries. The easiest option is to disable the mutates for the dark-launch traffic, returning a dummy response after the mutate is prepared but before it’s sent. This is safe, but it does mean that you’re not getting a full measurement of the dark launched service — what if it has a bug that causes 10% of the mutate requests to be incorrectly specified?

Alternatively, you might choose to send the mutation to a temporary duplicate of your existing storage. This is much better for the fidelity of your test, but great care will be needed to avoid sending real users the response from your temporary duplicate. It would also be very unfortunate for everyone if, at the end of your dark launch, you end up making the new service live when it’s still sending mutations to the temporary duplicate storage.

Storage migration
If you’re doing a storage migration — moving an existing system’s stored data from one storage system to another (for instance, MySQL to MongoDB because you’ve decided that you don’t really need SQL after all) — you’ll find that dark launches will be crucial in this migration, but you’ll have to be particularly careful about how you handle mutation-inducing queries. Eventually you’ll need mutations to take effect in both your old and new storage systems, and then you’ll need to make the new storage system the canonical storage for all user queries.

A good principle is that, during this migration, you should always make sure that you can revert to the old storage system if something goes wrong with the new one. You should know which of your systems (old and new) is the master for a given set of queries, and hence holds the canonical state. The mastership generally needs to be easily mutable and able to revert responsibility to the original storage system without losing data.

The universal requirement for a storage migration is a detailed written plan reviewed by not just your system stakeholders but also by your technical experts from the involved systems. Inevitably, your plan will miss things and will have to adapt as you move through the migration. Moving between storage systems can be an awfully big adventure — expect us to address this in a future blog post.

Duplicate traffic costs
The great thing about a well-implemented dark launch is that it exercises the full service in processing a query, for both the original and new service. The problem this brings is that each query costs twice as much to process. That means you should do the following:

Make sure your backends are appropriately provisioned for 2x the current traffic. If you have quota in other teams’ backends, make sure it’s temporarily increased to cover the dark launch as well.
If you’re connection-sensitive, ensure that your frontends have sufficient slack to accommodate a 2x connection count.
You should already be monitoring latency from your existing frontends, but keep a close eye on this monitoring stat and consider tightening your existing alerting thresholds. As service latency increases, service memory likely also increases, so you’ll want to be alert for either of these stats breaching established limits.

In some cases, the service traffic is so large that a 100% dark launch is not practical. In these instances, we suggest that you determine the largest percentage launch that is practical and plan accordingly, aiming to get the most representative selection of traffic in the dark launch. Within Google, we tend to launch a new service to Googlers first before making the service public. However, experience has taught us that Googlers are often not representative of the rest of the world in how they use a service.

An important consideration if your service makes substantial use of caching is that a sub-50% dark launch is unlikely to see material benefits from caching and hence will probably significantly overstate estimated load at 100%.

You may also choose to test-load your new service at over 100% of current traffic by duplicating some traffic — say, firing off two queries to the new service for every original query. This is fine, but you should scale your quota increases accordingly. If your service is cache-sensitive, then this approach will probably not be useful as your cache hit rate will be artificially high.

Because of the load impact of duplicate traffic, you should carefully consider how to use load shedding in this experiment. In particular, all dark launch traffic should be marked “sheddable” and hence be the first requests to be dropped by your system when under load.

In any case, if your service on-call sees an unexpected increase in CPU/memory/latency, they should drop the dark launch to 0% and see if that helps.

Summary
If you’re thinking about a dark launch for a new service, consider writing a dark launch plan. In that plan, make sure you answer the following questions:

Do you have existing traffic which you can fork and send to your new service?
Where will you fork the traffic: the application frontend, or somewhere else?
Will you fire off the message to the new backend asynchronously, or will you wait for it and impose a timeout?
What will you do with requests that generate mutations?
How and where will you log the responses from the original and new services, and how will you compare them?

Are you logging the following things: response code, backend latency, and response message size?
Will you be diffing responses? Are there fields that cannot meaningfully be diffed which you should skip in your comparison?

Have you made sure that your backends can handle 2x the current peak traffic, and have you given them temporary quota for it?

If not, at what percentage traffic will you stop the dark launch?

How are you going to select traffic for participation in the dark launch percentage: randomly, or by hashing on a key such as user ID?
Which teams need to know that this dark launch is happening? Do they know how to escalate concerns?
What’s your rollback plan after you make your new service live?

It may be that you don’t have enough surprises or excitement in your life; in that case, you don’t need to worry about dark launches. But if you feel that your service gives you enough adrenaline rushes already, dark launching is a great technique to make service launches really, really boring.
Quelle: Google Cloud Platform

Cloud SQL for PostgreSQL updated with new extensions

By Greg Wilson, Head of Developer Advocacy

Among relational databases, PostgreSQL is the open-source solution of choice for a wide range of workloads. Back in March, we added support for PostgreSQL in Cloud SQL, our managed database service, with a limited set of features and extensions. Since then, we’ve been amazed by your interest, with many of you taking the time to suggest desired PostgreSQL extensions on the Issue Tracker and the Cloud SQL discussion group. This feedback has resulted in us adding the following 19 extensions, across four categories:

PostGIS: better support for geographic applications
Data type: a variety of new data types
Language: enhanced functionality with new processing languages
Miscellaneous: text search, cryptographic capabilities and integer aggregators, to name but a few

An extension is a piece of software that adds functionality, often data types and procedural languages, to PostgreSQL itself. If you already have a Cloud SQL for PostgreSQL database instance running, you can enable one or more of these extensions.

We’re continuing our journey with PostgreSQL on Cloud SQL. As we prepare for general availability, we’re working on automatic failover for high availability, read replicas, additional extensions and precise restores with point-in-time recovery. Stay tuned!

Thanks for your feedback and please keep it coming on the Issue Tracker and in the Cloud SQL discussion group! Your input helps shape the future of Cloud SQL and all Google Cloud products.
Quelle: Google Cloud Platform

Demystifying container vs VM-based security: Security in plaintext

By Jianing Guo, Product Manager

Containerized workloads have gained in popularity over the past few years for enterprises and startups alike. Containers can significantly improve development speed, lower costs by improving resource utilization, and improve production consistency; however, their unique security implications in comparison to traditional VM-based applications are often not well understood. At Google, we’ve been running container-based production infrastructure for more than a decade and want to share our perspective on how container security compares to traditional applications.

Containerized workloads differ from traditional applications in several major ways. They also provide a number of advantages:

Modularized applications (monolithic applications vs. microservices)
Lower release overhead (convenient packaging format and well defined CI/CD practices)
Shorter lifetimes, less risk to have outdated packages (months to years vs. days to hours)
Less drift from original state during runtime (less direct access for maintenance, since workload is short-lived and can easily be rebuilt and re-pushed)

Now let’s examine how these differences can affect various aspects of security.

Understanding the container security boundary
The most common misconception about container security is that containers should act as security boundaries just like VMs, and as they are not able to provide such guarantee, they are a less secure deployment option. However, containers should be viewed as a convenient packaging and delivering mechanism for applications, rather than as mini VMs.

In the same way that traditional applications are not perfectly isolated from one another within a VM, an attacker or rogue program could break out of a running container and gain control of other containers running on the same VM. However, with a properly secured cluster, a container breakout would require an unpatched vulnerability in the kernel, in the common container infrastructure (e.g., docker), or in other services exposed to the workload from the VM. To help reduce the risk of these attacks Google Container Engine provides fully managed nodes and actively monitors for vulnerabilities and outdated packages in the VM — including third party add-ons — and performs auto update and auto repair when necessary. This helps minimize the attack window for a container breakout when a new vulnerability is discovered.

A properly secured and updated VM provides process level isolation that applies to both regular applications as well as container workloads, and customers can use Linux security modules to further restrict a container’s attack surface. For example, Kubernetes, an open source production-grade container orchestration system, supports native integration with AppArmor, Seccomp and SELinux to impose restrictions on syscalls that are exposed to containers. Kubernetes also provides additional tooling to further support container isolation. PodSecurityPolicy allows customers to impose restriction on what a workload can do or access at the Node level. For particularly sensitive workloads that require VM level isolation, customers can use taint and toleration to help ensure only workloads that trust each other are scheduled on the same VM.

Ultimately, in the case of applications running in both VMs and containers, the VM provides the final security barrier. Just like you wouldn’t run programs with mixed security levels on the same VM, you shouldn’t run pods with mixed security levels on the same node due to the lack of guaranteed security boundaries between pods.

Minimizing outdated packages
One of the most common attack vectors for applications running in a VM is vulnerabilities in outdated packages. In fact, 99.9% of exploited vulnerabilities are compromised more than a year after the CVE was published (Verizon Data Breach Investigation Report, 2015). With monolithic applications, application maintainers often patch OSes and applications manually and VM-based workloads often run for an extended period of time before they’re refreshed.

In the container world, microservices and well defined CI/CD pipelines make it easier to release more frequently. Workloads are typically short-lived (days or even hours), drastically reducing the attack surface for outdated application packages. Container Engine’s host OS is hardened and updated automatically. Further, for customers who adopt fully managed nodes, the guest OS and system containers are also patched and updated automatically, which helps to further reduce the risk from known vulnerabilities.

In short, containers go hand in hand with CI/CD pipelines that allow for very regular releases and update the containers with the latest patches as frequently as possible.

Towards centralized governance
One of the downsides of running traditional applications on VMs is that it’s nearly impossible to understand exactly what software is running in your production environment, let alone control exactly what software is being deployed. This is a result of three primary root causes:

The VM is an opaque application packaging format, and it’s hard to establish a streamlined workflow to examine and catalog its content prior to deployment
VM image management is not standardized or widely adopted, and it’s often hard to track down every image that has ever been deployed to a project
Due to VM workloads’ long lifespans, administrators must frequently manipulate running workloads to update and maintain both the applications and the OS, which can cause significant drift from the application’s original state when it was deployed

And because it’s hard to determine the accurate states of traditional applications at scale, the typical security controls will approximate by focusing on anomaly detection in application and OS behaviors and settings.

In contrast, containers provide a more transparent, easy-to-inspect and immutable format for packaging applications, making it easy to establish a workflow to inspect and catalog container content prior to deployment. Containers also come with a standardized image management mechanism (a centralized image repository that keeps track of all versions of a given container). And because containers are typically short-lived and can easily be rebuilt and re-pushed, there’s typically less drift of a running container from its deploy-time state.

These properties help turn container dev and deploy workflows into key security controls. By making sure that only the right containers built by the right process with the right content are deployed, organizations can gain control and knowledge of exactly what’s running in their production environment.

Shared security ownership
In some ways, traditional VM-based applications offer a simpler security model than containerized apps. Their runtime environment is typically created and maintained by a single owner, and IT maintains total control over the code they deploy to production. Infrequent and drawn-out releases also mean that centralized security teams can examine every production push in detail.

Containers, meanwhile, enable agile release practices that allow faster and more frequent pushes to production, leaving less time for centralized security reviews, and shifting the responsibility for security back to developers.

To mitigate the risks introduced by faster development and decentralized security ownership, organizations adopting containers should also adopt best practices highlighted in the previous section such as having a private registry to centrally control external dependencies in a production deployment (e.g., open-source base images); image scanning as part of CI/CD process to identify vulnerabilities and problematic dependencies; and deploy-time controls to help ensure only known good software gets deployed to production.

Overall, an automated and streamlined secure software supply chain that ensures software quality and provenance can provide significant security advantages and can still incorporate periodic manual review.

Summary

While many of the security limitations of VM-based applications hold true for containers (for now), using containers for application packaging and deployment creates opportunities for more accurate and streamlined security controls.

Watch this space for future posts that dig deep on containers, security and effective software development teams.

Visit our webpage to learn more about the Google Cloud Platform (GCP) security model.
Quelle: Google Cloud Platform

Announcing price cuts on Local SSDs for on-demand and preemptible instances

By Chris Kleban and Michael Basilyan, Product Managers

Starting today, you’ll pay up to 63% less for Local solid-state disks (SSDs) attached to on-demand Google Compute Engine virtual machines. That’s $0.080 per GB per month in most US regions. We’re also introducing even lower prices for Local SSDs used with Preemptible VM instances: up to 71% cheaper than before. That’s $0.064 per GB per month in most US regions.

At Google we’re always looking to reduce total cost of ownership for our customers, pass along price reductions achieved through technology advancements and adjust our pricing so you can take advantage of technology that will help you innovate, in a manner that’s simple for our users.

Local SSD is our high performance, physically attached block storage offering that persists as long as your instance exists. Supporting both NVMe and ISCSI interfaces, Local SSD provides the high IOPs and bandwidth performance that the world’s most demanding workloads require. Local SSD is often the preferred option for your scratch disks, caching layers and scale-out databases like NoSQL.

A key feature of Local SSDs is that you can attach any amount of Local SSD storage to an any machine shape. You aren’t locked in at a fixed ratio of Local SSD capacity to a VM’s vCPU count and memory. Also, Local SSDs are available on the same instances as GPUs, giving you flexibility in building the most high performance systems.

In addition to dropping prices on Local SSDs attached to regular, on-demand instances, we’re lowering the price for Local SSDs attached to Preemptible VMs. Preemptible VMs are just like any other Compute Engine VM, with the caveat that they cannot run for more than 24 hours and that we can preempt (shut down) the VM earlier if we need the capacity for other purposes. This allows us to use our data center capacity more efficiently and share the savings with you. You may request special Local SSD quota for use with Preemptible instances, though your current Local SSD quota works as well (learn more).

Google Cloud Platform (GCP) customers use Preemptible VMs to greatly reduce their compute costs, and have come up with lots of interesting use cases along the way. Our customers are using Preemptible VMs with Local SSDs to analyze financial markets, process data, render movies, analyze genomic data, transcode media and complete a variety of business and engineering tasks, using thousands of Preemptible VM cores in a single job.

We hope that the price reduction on Local SSDs for on-demand and Preemptible VMs will unlock new opportunities and help you solve more interesting business, engineering and scientific problems.

For more details, check out our documentation for Local SSDs and Preemptible VMs. For more pricing information, take a look at the Compute Engine Local SSD pricing page or try out our pricing calculator. If you have questions or feedback, go to the Getting Help page.

We’re excited to see what you build with our products. If you want to share stories and demos of the cool things you’ve built with Compute Engine, reach out on Twitter, Facebook or G+.
Quelle: Google Cloud Platform

Introducing automated deployment to Kubernetes and Google Container Engine with Codefresh

By Raziel Tabib, CEO, Codefresh

Editor’s Note: Today we hear from our partner Codefresh, which just launched a deep integration with Google Container Engine to make it easier to deploy containers to Kubernetes. Read on for more details about the integration and how to automate deployments to Container Engine in just a few minutes.

Codefresh is an opinionated toolchain for delivering containers. Our customers use it to handle both the automated and manual tasks associated with building, testing, debugging and deploying containers. Container-based applications running on Kubernetes are more scalable and reliable, and we want to streamline the process for getting containers deployed. That’s why we’re proud to announce Codefresh’s 10-minute setup for deploying to Kubernetes.

We’ve tested this integration with new and advanced users. Novice Kubernetes users tell us that Codefresh makes it incredibly easy to get their applications deployed to Kubernetes. Advanced users tell us that they like how they can easily access the full features of Kubernetes and configure them for their applications.

How to start deploying to Kubernetes in four steps
In just a few steps, you can get up and running with Codefresh and start deploying containers to Kubernetes. Here’s a short video that shows how it’s done.

Alternately, here’s an overview:

Step 1: Create cluster On Google Cloud
From Google Cloud Console, Navigate to Container Engine and click “Create a container cluster.”

Step 2: Connect Codefresh to Google Cloud Platform (GCP)
Login to Codefresh (it’s free), go to Admin->Integrations and login with Google.

Step 3: Add a cluster
Once you’ve added a cluster, it’s available in automated pipelines and manual image deployments.

Step 4: Start deploying!
Set ports, replicas, expose services or just let the defaults be your guide.

Step 5 (optional): Tweak generated Yaml files
Codefresh’s configuration screens also generate deployment.yml and pod.yml files, which you can then edit directly. Advanced users can use their own yml files and let Codefresh handle the authentication, deployment, etc.

Connecting the build, test, deploy pipeline
Once you’ve configured Codefresh and GCP, you can automate deployment with testing, approval workflows and certification. With Codefresh, developers and DevOps teams can agree upfront on rules and criteria for when images should go to manual testing, onto canary clusters or deployment in production.

Further, this mix of infrastructure and automation allows teams to iterate faster and ultimately provide higher-quality code changes.

Join us for a webinar co-hosted by GCP and Codefresh
Want to learn more? Google Container Engine Product Manager, William Denniss, will join Full-Stack Developer, Dan Garfield of Codefresh to show how development velocity speeds up when connected to a Kubernetes-native pipeline. Register here for the August 30th webinar.

Want to get started deploying to Kubernetes? Codefresh is offering 200 builds per month for free and $500 in GCP credits for new accounts1. Try it out.

1 Terms and conditions apply

Quelle: Google Cloud Platform

Independent research firm names Google Cloud the Insight Platform as PaaS Leader

By Regina Hoshimi, Head of Analyst Relations

Forrester Research, a leading analyst firm, just named Google Cloud Platform (GCP) the leader in The Forrester Wave™: Insight Platforms-As-A-Service, Q3 2017, its analysis of cloud providers offering Platform as a Service. According to the report, an insight PaaS makes it easier to:

Manage and access large, complex data sets
Update and evolve applications that deliver insight at the moment of action
Update and upgrade technology
Integrate and coordinate team member activities

For this Wave, Forrester evaluated eight separate vendors. It looked at 36 evaluation criteria spanning three broad buckets — current offering, strategy and market presence.

Of the eight vendors, Google Cloud’s insight PaaS scored highest for both current offering and strategy.

“Google was the only vendor in our evaluation to offer insight execution features like full machine learning automation with hyperparameter tuning, container management and API management. Google will appeal to firms that want flexibility and extreme scalability for highly competent data scientists and cloud application development teams used to building solutions on PaaS.” — The Forrester Wave: Insight Platforms-As-A-Service, Q3 2017
Our presence in the Insight Platform as a Service market goes way back. We started with a vision for serverless computing back in 2008 with Google App Engine and added serverless data processing in 2010 with Google BigQuery. In 2016 we added machine learning (Cloud Machine Learning Engine) to GCP to help bring the power of TensorFlow (Google’s open source machine learning framework) to everyone. We continue to be amazed by what companies like Snap and The Telegraph are doing with these technologies and look forward to building on these insight services to help you build the amazing applications of tomorrow.

Sign up here to get a complimentary copy of the report.
Quelle: Google Cloud Platform