{"id":44614,"date":"2016-07-18T20:13:50","date_gmt":"2016-07-18T17:13:50","guid":{"rendered":"https:\/\/www.altoros.com\/blog\/?p=44614"},"modified":"2019-06-24T18:55:30","modified_gmt":"2019-06-24T15:55:30","slug":"an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity","status":"publish","type":"post","link":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/","title":{"rendered":"An Outstanding Cloud Foundry Feature: App Placement and Host Affinity"},"content":{"rendered":"<p>Out of the box, Cloud Foundry doesn\u2019t give us the ability to control application placement or to specify a target host(s) for an application. This may be critical when one needs to separate apps between different environments or host types\u2014or for any other type of app segregation. The good news is that this can be resolved very easily.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#Why_bother\" >Why bother?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#Solution_well_a_workaround\" >Solution (well, a workaround)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#Instructions_for_Diego\" >Instructions for Diego<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#Instructions_for_DEA\" >Instructions for DEA<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#A_sample_application_manifest\" >A sample application manifest<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#Further_reading\" >Further reading<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Why_bother\"><\/span>Why bother?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Scenarios where this ability may be needed:<\/p>\n<ul>\n<li style=\"margin-bottom: 6px;\">physical separation of applications between environments in a single Cloud Foundry deployment (e.g., development \/ staging \/ production)<\/li>\n<li style=\"margin-bottom: 6px;\">segregation of applications by the host\u2019s hardware (<code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">slow_but_cheap<\/code>\/<code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">fast_but_expensive<\/code>\/<code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">with_gpu<\/code>)<\/li>\n<li style=\"margin-bottom: 6px;\">placing together two microservices that have a huge amount of communication traffic and will benefit from lower latencies<\/li>\n<li style=\"margin-bottom: 6px;\">a use case with only asingle app instance per host (e.g., a crypto that encrypts traffic for the whole host)<\/li>\n<li>well, actually, for any other type of segregation<\/li>\n<\/ul>\n<p>One would say, okey, but we already have Availability Zones (AZ)!<\/p>\n<p>It is a different thing. Cloud Foundry tries to balance (using internal algorithms) instances of an application between AZs. There is no way to specify a target AZ for an application or an instance of an application. \u201cHost affinity\u201d or \u201cplacement constraints\u201d are needed to control application placement.<\/p>\n<p>For instance, a reference architecture of your deployment may look like the one below.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png\" alt=\"an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\" width=\"640\" class=\"aligncenter size-full wp-image-44616\" \/><\/a><small>A sample deployment architecture<\/small><\/center><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Solution_well_a_workaround\"><\/span>Solution (well, a workaround)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In brief, it is possible to control application placement by defining stacks with custom names in the Cloud Foundry deployment manifest. There is no need to actually create them, and no release modification is needed.<\/p>\n<p>Cloud Foundry uses the concept of stacks (prebuilt root file systems) to support specific operation systems. Here are some of the examples:<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cflinuxfs2<\/code><\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">windows2012R2<\/code><\/li>\n<\/ul>\n<p>However, nothing stops us from listing more stacks, even without creating modifications to them:<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cflinuxfs2_dev<\/code><\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cflinuxfs2_stg<\/code><\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cflinuxfs2_prd<\/code><\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">name_of_your_choice<\/code><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Instructions_for_Diego\"><\/span>Instructions for Diego<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In our example, we define a \u201cproduction\u201d affinity group of hosts, so that every application for production (and only for production) will run on the specific group of hosts. All you need is to modify your Cloud Foundry deployment manifest. No need to create new stacks. No need to modify a Cloud Foundry release, as well. Just list your stacks in the Cloud Controller properties.<\/p>\n<pre style=\"padding-left: 20px;\">properties:\r\n...\r\n  cc:\r\n    stacks:\r\n      - name: \"cflinuxfs2\"\r\n        description: \"Cloud Foundry Linux-based filesystem\"\r\n      - <strong>: \"cflinuxfs2_prd\"\r\n        description: \"Cloud Foundry Linux-based filesystem (PRODUCTION)\"<\/strong><\/pre>\n<p>Define your affinity group (REP properties).<\/p>\n<pre style=\"padding-left: 20px;\">- instances: 10\r\n  name: cell_z1_prd\r\n  networks:\r\n  - name: diego_prd1\r\n  properties:\r\n    <strong>diego:\r\n      rep:\r\n        stack: cflinuxfs2_prd\r\n        preloaded_rootfses: \r\n          - \"cflinuxfs2_prd:\/var\/vcap\/packages\/rootfs_cflinuxfs2\/rootfs\"\r\n        zone: z1<\/strong><\/pre>\n<p>Modify Diego properties for the NSYNC and STAGER components.<\/p>\n<pre style=\"padding-left: 20px;\">properties:\r\n  diego:\r\n...\r\n    nsync:\r\n      lifecycle_bundles:\r\n        - \"buildpack\/cflinuxfs2:buildpack_app_lifecycle\/buildpack_app_lifecycle.tgz\"\r\n        - <strong>\"buildpack\/cflinuxfs2_prd:buildpack_app_lifecycle\/buildpack_app_lifecycle.tgz\"<\/strong>\r\n        - \"buildpack\/windows2012R2:windows_app_lifecycle\/windows_app_lifecycle.tgz\"\r\n        - \"docker:docker_app_lifecycle\/docker_app_lifecycle.tgz\"\r\n\r\n...\r\n    stager:\r\n      lifecycle_bundles:\r\n        - \"buildpack\/cflinuxfs2:buildpack_app_lifecycle\/buildpack_app_lifecycle.tgz\"\r\n        - <strong>\"buildpack\/cflinuxfs2_prd:buildpack_app_lifecycle\/buildpack_app_lifecycle.tgz\"<\/strong>\r\n        - \"buildpack\/windows2012R2:windows_app_lifecycle\/windows_app_lifecycle.tgz\"\r\n        - \"docker:docker_app_lifecycle\/docker_app_lifecycle.tgz\"<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Instructions_for_DEA\"><\/span>Instructions for DEA<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The same as with Diego, all you need is to modify your Cloud Foundry deployment manifest. List your stacks in the Cloud Controller properties.<\/p>\n<pre style=\"padding-left: 20px;\">properties:\r\n...\r\n  cc:\r\n    stacks:\r\n      - name: \"cflinuxfs2\"\r\n        description: \"Cloud Foundry Linux-based filesystem\"\r\n      - <strong>name: \"cflinuxfs2_prd\"\r\n        description: \"Cloud Foundry Linux-based filesystem (PRODUCTION)\"<\/strong><\/pre>\n<p>Define your affinity group (DEA properties).<\/p>\n<pre style=\"padding-left: 20px;\">- instances: 10\r\n  name: runner_z1_prd\r\n  networks:\r\n  - name: cf1\r\n    static_ips: null\r\n  properties:\r\n    consul:\r\n      agent:\r\n        services:\r\n          dea:\r\n            check:\r\n              interval: 5m\r\n              name: dns_health_check\r\n              script: \/var\/vcap\/jobs\/dea_next\/bin\/dns_health_check\r\n              status: passing\r\n    dea_next:\r\n      zone: z1\r\n      <strong>stacks:\r\n        - name: \"cflinuxfs2_prd\"\r\n          package_path: \"\/var\/vcap\/packages\/rootfs_cflinuxfs2\/rootfs\"<\/strong><\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"A_sample_application_manifest\"><\/span>A sample application manifest<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To target specific affinity group (in our example, \u201cproduction\u201d) just specify the appropriate stack in your application manifest.<\/p>\n<pre style=\"padding-left: 20px;\">---\r\napplications:\r\n- name: hello-spring-cloud\r\n  memory: 512M\r\n  instances: 1\r\n  host: hello-spring-cloud-${random-word}\r\n  path: target\/hello-spring-cloud-0.0.1-SNAPSHOT.jar\r\n  buildpack: java_buildpack\r\n  <strong>stack: cflinuxfs2_prd<\/strong>\r\n  env:\r\n    SPRING_PROFILES_DEFAULT: cloud<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>So, as you can see, it is pretty easy to define affinity groups in Cloud Foundry and to control application placement. It would be great to see this as a native feature in Cloud Foundry, but this workaround also works well.<\/p>\n<p>We\u2019d also like to see the ability to specify placement constraints in the application manifest, as featured below.<\/p>\n<pre style=\"padding-left: 20px;\">--\r\nconstraints:\r\n- production\r\n- with_gpu<\/pre>\n<p>Pros:<\/p>\n<ul>\n<li>no need to build your own custom stack<\/li>\n<li>no need to modify a Cloud Foundry release<\/li>\n<li>No need to modify your applications<\/li>\n<li>Works for DEA and Diego cells<\/li>\n<\/ul>\n<p>Cons:<\/p>\n<ul>\n<li>No way to request a list of constraints<\/li>\n<li>May require buildpack customization (The Java buildpack works well, but I\u2019ve experienced some limitations for the Python buildpack.)<\/li>\n<\/ul>\n<p>In addition, to separate app traffic, it is also worth considering using different load balancers \/ routers for different affinity groups (at the DNS level). Please share your thoughts if you have anything else to add.<\/p>\n<hr \/>\n<p><center><\/p>\n<p dir=\"ltr\"><small>Many thanks to <a href=\"https:\/\/www.linkedin.com\/in\/zgrinch\/\" rel=\"noopener noreferrer\" target=\"_blank\">Sean Keery<\/a> (Pivotal) and <a href=\"https:\/\/www.linkedin.com\/in\/duncan-winn-3019506\/\" rel=\"noopener noreferrer\" target=\"_blank\">Duncan Winn<\/a> (Pivotal) for inspiration!<\/small><\/p>\n<p><\/center><\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Further_reading\"><\/span>Further reading<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/how-to-create-a-perfect-cloud-foundry-manifest\/\">How to Create a Perfect Cloud Foundry Manifest<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/tuning-configuration-of-the-cloud-foundry-java-buildpack-to-avoid-out-of-memory-errors\/\">Tuning Configuration of the CF Java Buildpack to Avoid Out-of-Memory Errors<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/multi-data-center-as-a-cloud-foundry-deployment-pattern\/\">Multi-Data Center as a Cloud Foundry Deployment Pattern<\/a><\/li>\n<\/ul>\n<hr \/>\n<p><center><small>This post was written by <b>Aliaksandr Prysmakou<\/b> and edited by <a href=\"https:\/\/www.altoros.com\/blog\/author\/sophie.turol\/\">Sophia Turol<\/a>.<\/small><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Out of the box, Cloud Foundry doesn\u2019t give us the ability to control application placement or to specify a target host(s) for an application. This may be critical when one needs to separate apps between different environments or host types\u2014or for any other type of app segregation. The good news [&#8230;]<\/p>\n","protected":false},"author":39,"featured_media":44616,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[214],"tags":[873,206],"class_list":["post-44614","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-cloud-native","tag-oss-cloud-foundry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>An Outstanding Cloud Foundry Feature: App Placement and Host Affinity | Altoros<\/title>\n<meta name=\"description\" content=\"With a sample app manifest, this article shows how to define affinity groups in Cloud Foundry to achieve segregation of resources.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"An Outstanding Cloud Foundry Feature: App Placement and Host Affinity | Altoros\" \/>\n<meta property=\"og:description\" content=\"Out of the box, Cloud Foundry doesn\u2019t give us the ability to control application placement or to specify a target host(s) for an application. This may be critical when one needs to separate apps between different environments or host types\u2014or for any other type of app segregation. The good news [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/\" \/>\n<meta property=\"og:site_name\" content=\"Altoros\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-18T17:13:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-06-24T15:55:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Aliaksandr Prysmakou\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Aliaksandr Prysmakou\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/\"},\"author\":{\"name\":\"Aliaksandr Prysmakou\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ca769005f4d785a1f0c791313254262\"},\"headline\":\"An Outstanding Cloud Foundry Feature: App Placement and Host Affinity\",\"datePublished\":\"2016-07-18T17:13:50+00:00\",\"dateModified\":\"2019-06-24T15:55:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/\"},\"wordCount\":655,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png\",\"keywords\":[\"Cloud-Native\",\"OSS Cloud Foundry\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/\",\"name\":\"An Outstanding Cloud Foundry Feature: App Placement and Host Affinity | Altoros\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png\",\"datePublished\":\"2016-07-18T17:13:50+00:00\",\"dateModified\":\"2019-06-24T15:55:30+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ca769005f4d785a1f0c791313254262\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png\",\"contentUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"An Outstanding Cloud Foundry Feature: App Placement and Host Affinity\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/\",\"name\":\"Altoros\",\"description\":\"Insight\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ca769005f4d785a1f0c791313254262\",\"name\":\"Aliaksandr Prysmakou\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7a200d186ae9316c7d174cf2290417a7bab1f5cffb9e880f7c3b0ea5eed08898?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7a200d186ae9316c7d174cf2290417a7bab1f5cffb9e880f7c3b0ea5eed08898?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7a200d186ae9316c7d174cf2290417a7bab1f5cffb9e880f7c3b0ea5eed08898?s=96&d=mm&r=g\",\"caption\":\"Aliaksandr Prysmakou\"},\"description\":\"Aliaksandr Prysmakou is a Cloud Foundry DevOps Engineer at Altoros. He is an expert in cloud automation and virtualization. As a member of a joint team formed by Canonical, Pivotal, and Altoros, Alex worked on automating Cloud Foundry deployment with the Juju orchestration platform. He also contributed to extending BOSH to support new cloud providers. Previously, Alex designed templates to automate management of Microsoft solutions on the RightScale platform and provided fault tolerance for Microsoft SQL Server.\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/author\\\/alex-prismakov\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"An Outstanding Cloud Foundry Feature: App Placement and Host Affinity | Altoros","description":"With a sample app manifest, this article shows how to define affinity groups in Cloud Foundry to achieve segregation of resources.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/","og_locale":"en_US","og_type":"article","og_title":"An Outstanding Cloud Foundry Feature: App Placement and Host Affinity | Altoros","og_description":"Out of the box, Cloud Foundry doesn\u2019t give us the ability to control application placement or to specify a target host(s) for an application. This may be critical when one needs to separate apps between different environments or host types\u2014or for any other type of app segregation. The good news [...]","og_url":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/","og_site_name":"Altoros","article_published_time":"2016-07-18T17:13:50+00:00","article_modified_time":"2019-06-24T15:55:30+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png","type":"image\/png"}],"author":"Aliaksandr Prysmakou","twitter_misc":{"Written by":"Aliaksandr Prysmakou","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#article","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/"},"author":{"name":"Aliaksandr Prysmakou","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/7ca769005f4d785a1f0c791313254262"},"headline":"An Outstanding Cloud Foundry Feature: App Placement and Host Affinity","datePublished":"2016-07-18T17:13:50+00:00","dateModified":"2019-06-24T15:55:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/"},"wordCount":655,"commentCount":0,"image":{"@id":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png","keywords":["Cloud-Native","OSS Cloud Foundry"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/","url":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/","name":"An Outstanding Cloud Foundry Feature: App Placement and Host Affinity | Altoros","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#primaryimage"},"image":{"@id":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png","datePublished":"2016-07-18T17:13:50+00:00","dateModified":"2019-06-24T15:55:30+00:00","author":{"@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/7ca769005f4d785a1f0c791313254262"},"breadcrumb":{"@id":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#primaryimage","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/www.altoros.com\/blog\/an-outstanding-cloud-foundry-feature-app-placement-and-host-affinity\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.altoros.com\/blog\/"},{"@type":"ListItem","position":2,"name":"An Outstanding Cloud Foundry Feature: App Placement and Host Affinity"}]},{"@type":"WebSite","@id":"https:\/\/www.altoros.com\/blog\/#website","url":"https:\/\/www.altoros.com\/blog\/","name":"Altoros","description":"Insight","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.altoros.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/7ca769005f4d785a1f0c791313254262","name":"Aliaksandr Prysmakou","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7a200d186ae9316c7d174cf2290417a7bab1f5cffb9e880f7c3b0ea5eed08898?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7a200d186ae9316c7d174cf2290417a7bab1f5cffb9e880f7c3b0ea5eed08898?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7a200d186ae9316c7d174cf2290417a7bab1f5cffb9e880f7c3b0ea5eed08898?s=96&d=mm&r=g","caption":"Aliaksandr Prysmakou"},"description":"Aliaksandr Prysmakou is a Cloud Foundry DevOps Engineer at Altoros. He is an expert in cloud automation and virtualization. As a member of a joint team formed by Canonical, Pivotal, and Altoros, Alex worked on automating Cloud Foundry deployment with the Juju orchestration platform. He also contributed to extending BOSH to support new cloud providers. Previously, Alex designed templates to automate management of Microsoft solutions on the RightScale platform and provided fault tolerance for Microsoft SQL Server.","url":"https:\/\/www.altoros.com\/blog\/author\/alex-prismakov\/"}]}},"_links":{"self":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/44614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/comments?post=44614"}],"version-history":[{"count":22,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/44614\/revisions"}],"predecessor-version":[{"id":44657,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/44614\/revisions\/44657"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media\/44616"}],"wp:attachment":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media?parent=44614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/categories?post=44614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/tags?post=44614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}