{"id":35478,"date":"2021-05-19T17:09:08","date_gmt":"2021-05-19T14:09:08","guid":{"rendered":"https:\/\/orbitsoft.com\/blog\/?p=35478"},"modified":"2023-06-26T12:36:32","modified_gmt":"2023-06-26T09:36:32","slug":"php-to-go","status":"publish","type":"post","link":"https:\/\/orbitsoft.com\/blog\/php-to-go\/","title":{"rendered":"Network saves $21,000 per year on Ad Management System: the case of changing programming language from PHP to Go"},"content":{"rendered":"\n<p>The network in question is responsible for advertising performance of a service with entertainment content.  For this task they employ a variety of solutions, including the Orbitsoft ad management system.<\/p>\n\n\n\n<p>We were tasked with improving system performance while reducing maintenance and development costs.  One solution was to change the programming language from PHP to Go.  Here we\u2019ll tell you how we solved this problem and what came of it.<\/p>\n\n\n<div class=\"wp-block-lazyblock-case lazyblock-case-Z2jfIid\"><div class=\"styled-block\">\n  <div class=\"styled-block__main\">\n        <ul class=\"case__list\">\n            \n                    <li class=\"case__item\">\n              \n          <span class=\"case__order\">01<\/span>\n          <div class=\"case__body\">\n            <div class=\"case__title\">\n              <span>Customer<\/span>\n            <\/div>\n            <p>a network that manages advertising for a service with entertainment content.<\/p>          <\/div>\n        <\/li>\n            \n                    <li class=\"case__item\">\n              \n          <span class=\"case__order\">02<\/span>\n          <div class=\"case__body\">\n            <div class=\"case__title\">\n              <span>Business &#8211; tasks:<\/span>\n            <\/div>\n            <ul>\n<li>reduce cost of maintaining servers required for ad management system<\/li>\n<li>conserve resources for system updates<\/li>\n<li>improve system performance<\/li>\n<li>reduce processing time of ads display requests<\/li>\n<\/ul>          <\/div>\n        <\/li>\n            \n                    <li class=\"case__item\">\n              \n          <span class=\"case__order\">03<\/span>\n          <div class=\"case__body\">\n            <div class=\"case__title\">\n              <span>Solution<\/span>\n            <\/div>\n            <p>replace programming language PHP with Go<\/p>          <\/div>\n        <\/li>\n            \n                    <li class=\"case__item case__item_marked\">\n              \n          <span class=\"case__order\">04<\/span>\n          <div class=\"case__body\">\n            <div class=\"case__title\">\n              <span>Results:<\/span>\n            <\/div>\n            <ul>\n<li>$21,600 savings on system maintenance per year<\/li>\n<li>Cut response time from 250 milliseconds to 150 milliseconds<\/li>\n<li>Now just 3 servers are needed instead of 6 for ads display<\/li>\n<\/ul>          <\/div>\n        <\/li>\n          <\/ul>\n  <\/div>\n  <\/div><\/div>\n\n<div class=\"wp-block-lazyblock-heading lazyblock-heading-Zr6SHj\"><h2 class=\"article__h\">Impressions growth from 30 million to 800 million per day <\/h2><\/div>\n\n\n<p>The network is responsible for the effectiveness of the ads displayed by the entertainment content service.  We have been working with this network for 11 years.<\/p>\n\n\n\n<p>We developed an ad management and display system.  It can be conditionally divided into three large parts:<\/p>\n\n\n\n<ul>\n<li>a control panel where advertisers and publishers (website owners) operate<\/li>\n\n\n\n<li>a set of services that are responsible for ads display<\/li>\n\n\n\n<li>service tools<\/li>\n<\/ul>\n\n\n\n<p>The system load is constantly growing.  When we started, the service had from 20 to 30 million ads per day, a year later they had 100 million, and at the beginning of 2021 an astounding 800 million.  To ensure maximum system performance, we regularly update processes, internal solutions, and anything else that can help the network and service earn more from advertising.<\/p>\n\n\n<div class=\"wp-block-lazyblock-heading lazyblock-heading-Z1XO8Ex\"><h2 class=\"article__h\">Problem: PHP language limitations and expensive server maintenance <\/h2><\/div>\n\n\n<p>Until 2020 the ad management system worked in PHP 5.6.  We chose PHP to save on customer expenses.  For example, the cost of development and specialist services for PHP is lower than for Java and C++.  Additionally, system customization in this language requires less time than the same customization in Java.<\/p>\n\n\n\n<p><strong>Expensive service.<\/strong>  For a time, the system handled the given tasks well enough.  But as the load grew, problems appeared.  The first problem was that service for the customer became more expensive and more complicated.<\/p>\n\n\n<div class=\"wp-block-lazyblock-figure lazyblock-figure-Ev3Km\"><figure class=\"article__figure  article__figure_no-shadow\">\n        <div class=\"article__figure-img\" >\n        <img decoding=\"async\" src=\"https:\/\/orbitsoft.com\/blog\/wp-content\/uploads\/dc7e3c0f-24d3-4e4a-b5e1-7645aafefabb.jpeg\" alt=\"\">\n    <\/div>\n        <\/figure><\/div>\n\n\n<p><strong>Insufficient response speed. <\/strong> It takes time to request and process ads, and if it takes too long, the ad network risks reputation and revenue.<\/p>\n\n\n\n<p>Let&#8217;s say an ad banner is placed at the top of a page.  If the ad management system is slow to respond, the banner may not appear immediately on the website.<\/p>\n\n\n\n<p>And while the system is working on a response, a user can scroll down the page and leave without seeing the ad.<\/p>\n\n\n\n<p>Officially, the ad was shown, so the advertiser has to pay.  In fact, the advertiser is simply paying for air, and no one likes that.<\/p>\n\n\n\n<p>Slow response speed affects relationships with partners.  If the system takes a long time to respond, sites load slower, and this in turn reduces revenue.  Most likely, a client will begin looking for a different ad network.<\/p>\n\n\n\n<p>System maintenance costs also depend on response time.  The faster the system processes a request, the faster server resources are freed up to process the next request, so more requests can be processed on the same hardware.  For the customer, this means savings on servers and maintenance.<\/p>\n\n\n<div class=\"wp-block-lazyblock-important-block lazyblock-important-block-1QX7Oa\"><div class=\"important-box\">\n  <div class=\"important-box__main\">\n          <p class=\"important-box__h\">Technical block: system metrics in PHP<\/p>\n      \t<p>6 servers, excluding storage.<\/p>\n<p>Peak consumption:<\/p>\n<ul>\n<li>CPU &#8211; at the level of 75%<\/li>\n<li>RAM &#8211; 90%<\/li>\n<\/ul>\n<p>Response time: 250 ms<\/p>\n<p>Configuration of servers: Dual Hexa-core Xeon E5-2620 v3 2.4 GHz 48.00 GB RAM 2x SSD 256 GB.<\/p>  <\/div>\n  <\/div><\/div>\n\n<div class=\"wp-block-lazyblock-heading lazyblock-heading-Z1ysnUV\"><h2 class=\"article__h\">Solution: switch from PHP to Go <\/h2><\/div>\n\n\n<p>Over 11 years working with the client, we optimized the system to the maximum possible.  We had reached a point where the only way to increase performance was to change the language.  We considered both Go and Java, as we have experience and knowledge in working with both languages, but in the end we chose Go.  In our opinion, this is the more cost-effective choice and easier for the customer to adapt to.<\/p>\n\n\n<div class=\"wp-block-lazyblock-figure lazyblock-figure-ZugibC\"><figure class=\"article__figure  article__figure_no-shadow\">\n        <div class=\"article__figure-img\" >\n        <img decoding=\"async\" src=\"https:\/\/orbitsoft.com\/blog\/wp-content\/uploads\/e98349f2-5577-49b9-afcf-21569363a692.jpeg\" alt=\"\">\n    <\/div>\n        <\/figure><\/div>\n\n\n<p>In addition to changing the platform, we implemented a few more changes:<\/p>\n\n\n\n<ul>\n<li>abandoned a monolithic application and switched to a microservice architecture<\/li>\n\n\n\n<li>implemented a full-fledged CI\/CD<\/li>\n\n\n\n<li>provided extensive coverage of unit code and integration tests<\/li>\n\n\n\n<li>created scripts for automatic deployment of updates<\/li>\n<\/ul>\n\n\n\n<p>Altogether, these changes allow the team to scale each component individually, deploy updates faster, and conserve server resources.  All of this also helps to significantly reduce customer expenses and increase the effectiveness of advertising.<\/p>\n\n\n\n<p>When developing and launching the new system, we did not turn off the existing servers and system, so the customer avoided downtime: everything worked as usual. To achieve this, the team sequentially moved each of the functions into separate services and then launched them individually.<\/p>\n\n\n<div class=\"wp-block-lazyblock-steps lazyblock-steps-1dqHhw\"><div class=\"styled-block\">\n  <div class=\"styled-block__main\">\n          <h3 class=\"styled-block__title\">\n        Process: how components were separated from a monolithic structure and output to separate services      <\/h3>\n        <ul class=\"steps__list\">\n              <li class=\"steps__item\">\n          <div class=\"steps__title\">\n            Analysis          <\/div>\n                    <ul>\n<li>Code state<\/li>\n<li>Dependencies<\/li>\n<\/ul>        <\/li>\n              <li class=\"steps__item\">\n          <div class=\"steps__title\">\n            Plan          <\/div>\n                      <div class=\"steps__description\">\n              How to separate the functions of a component into a separate service            <\/div>\n                            <\/li>\n              <li class=\"steps__item\">\n          <div class=\"steps__title\">\n            Development          <\/div>\n                            <\/li>\n              <li class=\"steps__item\">\n          <div class=\"steps__title\">\n            Testing          <\/div>\n                    <ul>\n<li>Automated<\/li>\n<li>Loaded<\/li>\n<\/ul>        <\/li>\n              <li class=\"steps__item\">\n          <div class=\"steps__title\">\n            Optimizing bottlenecks          <\/div>\n                            <\/li>\n              <li class=\"steps__item\">\n          <div class=\"steps__title\">\n            Development and launch          <\/div>\n                    <ul>\n<li>Scripts for automatic service deployment<\/li>\n<li>Service implementation and performance monitoring<\/li>\n<\/ul>        <\/li>\n          <\/ul>\n  <\/div>\n  <\/div><\/div>\n\n<div class=\"wp-block-lazyblock-banner lazyblock-banner-Z29y0T8\"><div \n  class=\"banner\n   \n  \" \n  >\n    <div class=\"banner__body\">\n        <h2 class=\"banner__h\">Ready-made products and custom development<\/h2>\n        <div class=\"banner__content\">\n            <h3>System and platforms<\/h3>\n<ul>\n<li>POS + inventory accounting system<\/li>\n<li>Tools for managing ads and buying traffic<\/li>\n<li>Big data processing solutions<\/li>\n<\/ul>\n<h3>Software products<\/h3>\n<ul>\n<li>Mobile apps<\/li>\n<li>Online shops<\/li>\n<li>Video platforms<\/li>\n<li>Online services<\/li>\n<\/ul>\n<h3>Development and support<\/h3>\n<ul>\n<li>System administration<\/li>\n<li>High-load systems developments<\/li>\n<\/ul>\n<h3>Consulting<\/h3>\n<ul>\n<li>Audit of existing software solutions<\/li>\n<li>Consultations: we will select the best technical solution for your tasks and tell you how to implement it<\/li>\n<\/ul>        <\/div>\n                            <div \n              class=\"banner__button button js-form-modal\n               button_style_light-on-promo2\">\n              Let&#8217;s Discuss Your Project                          <\/div>\n            <\/div>\n    <div class=\"banner__photo\">\n        <img decoding=\"async\" src=\"https:\/\/orbitsoft.com\/blog\/wp-content\/uploads\/screens.png\" alt=\"\" class=\"banner__img\">\n    <\/div>\n<\/div><\/div>\n\n<div class=\"wp-block-lazyblock-heading lazyblock-heading-zfsUe\"><h2 class=\"article__h\">Result: Reduced customer costs and accelerated system response <\/h2><\/div>\n\n\n<p>Before updating the system, we agreed with the customer regarding a goal of two tasks: reducing the cost of system maintenance, and achieving better performance for auction purchases.  This is what we achieved:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$21,600<\/td><td>3 servers<\/td><td>150 ms<\/td><\/tr><tr><td>\u2026savings on system maintenance per year<\/td><td>\u2026instead of 6 for system maintenance<\/td><td>\u2026response time instead of 250 ms<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>In total, the project took 8 months, during which we &#8211; as a permanent external team &#8211; solved the tasks agreed upon with the customer and completely rebuilt their system.<\/p>\n\n\n<div class=\"wp-block-lazyblock-important-block lazyblock-important-block-2aY5ci\"><div class=\"important-box\">\n  <div class=\"important-box__main\">\n          <p class=\"important-box__h\">Technical block of the project<\/p>\n      \t<p>Technologies:<\/p>\n<ul>\n<li>language: Go 1.13<\/li>\n<li>service interaction protocol: GRPC<\/li>\n<li>Service Discovery: Consul<\/li>\n<li>collection of metrics and monitoring: Prometheus<\/li>\n<li>CI\/CD: Bamboo<\/li>\n<li>deployment: Ansible<\/li>\n<\/ul>\n<p>Impact of language change<\/p>\n<p>After we rewrote all server components in Go, the load indicators dropped to the following values:<\/p>\n<ul>\n<li>CPU &#8211; 30%<\/li>\n<li>RAM &#8211; 40%<\/li>\n<\/ul>\n<p>Additional changes implemented:<\/p>\n<ul>\n<li>abandoned monolithic application in favor of microservice architecture<\/li>\n<li>implemented a full-fledged CI\/CD<\/li>\n<li>provided extensive coverage of unit code and integration tests<\/li>\n<li>developed scripts for automatic deployment of updates<\/li>\n<\/ul>  <\/div>\n  <\/div><\/div>\n\n<div class=\"wp-block-lazyblock-banner lazyblock-banner-Zrb72o\"><div \n  class=\"banner\n   banner_style_important \n  \" \n  >\n    <div class=\"banner__body\">\n        <h2 class=\"banner__h\">Business software solutions<\/h2>\n        <div class=\"banner__content\">\n            <p>Solutions for business automation, trade and warehouse accounting, and advertising management.<\/p>\n<p>Ready-made products and outsourcing services.<\/p>\n<p>Outstaffing services.<\/p>        <\/div>\n                            <div \n              class=\"banner__button button js-form-modal\n               button_style_light-on-promo\n              \">\n              Let&#8217;s Discuss Your Project                          <\/div>\n            <\/div>\n    <div class=\"banner__photo\">\n        <img decoding=\"async\" src=\"https:\/\/orbitsoft.com\/blog\/wp-content\/uploads\/friendship.png\" alt=\"\" class=\"banner__img\">\n    <\/div>\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>The network in question is responsible for advertising performance of a service with entertainment content. For this task they employ a variety of solutions, including the Orbitsoft ad management system. We were tasked with improving system performance while reducing maintenance and development costs. One solution was to change the programming language from PHP to Go. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":35599,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[196],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Network saves $21,000 per year on Ad Management System: the case of changing programming language from PHP to Go - OrbitSoft Blog<\/title>\n<meta name=\"description\" content=\"We reduced the cost of servers maintaining and improved the system performance by changing the programming language from PHP to Go\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/orbitsoft.com\/blog\/php-to-go\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Network saves $21,000 per year on Ad Management System: the case of changing programming language from PHP to Go - OrbitSoft Blog\" \/>\n<meta name=\"twitter:description\" content=\"We reduced the cost of servers maintaining and improved the system performance by changing the programming language from PHP to Go\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/orbitsoft.com\/blog\/wp-content\/uploads\/new-img9.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@orbitsoft\" \/>\n<meta name=\"twitter:site\" content=\"@orbitsoft\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Network saves $21,000 per year on Ad Management System: the case of changing programming language from PHP to Go - OrbitSoft Blog","description":"We reduced the cost of servers maintaining and improved the system performance by changing the programming language from PHP to Go","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:\/\/orbitsoft.com\/blog\/php-to-go\/","twitter_card":"summary_large_image","twitter_title":"Network saves $21,000 per year on Ad Management System: the case of changing programming language from PHP to Go - OrbitSoft Blog","twitter_description":"We reduced the cost of servers maintaining and improved the system performance by changing the programming language from PHP to Go","twitter_image":"https:\/\/orbitsoft.com\/blog\/wp-content\/uploads\/new-img9.jpg","twitter_creator":"@orbitsoft","twitter_site":"@orbitsoft","twitter_misc":{"Written by":"admin","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/orbitsoft.com\/blog\/php-to-go\/","url":"https:\/\/orbitsoft.com\/blog\/php-to-go\/","name":"Network saves $21,000 per year on Ad Management System: the case of changing programming language from PHP to Go - OrbitSoft Blog","isPartOf":{"@id":"https:\/\/orbitsoft.com\/blog\/#website"},"datePublished":"2021-05-19T14:09:08+00:00","dateModified":"2023-06-26T09:36:32+00:00","author":{"@id":"https:\/\/orbitsoft.com\/blog\/#\/schema\/person\/e515b3fa91e283750477594c4f028b7b"},"description":"We reduced the cost of servers maintaining and improved the system performance by changing the programming language from PHP to Go","breadcrumb":{"@id":"https:\/\/orbitsoft.com\/blog\/php-to-go\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/orbitsoft.com\/blog\/php-to-go\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/orbitsoft.com\/blog\/php-to-go\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/orbitsoft.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Network saves $21,000 per year on Ad Management System: the case of changing programming language from PHP to Go"}]},{"@type":"WebSite","@id":"https:\/\/orbitsoft.com\/blog\/#website","url":"https:\/\/orbitsoft.com\/blog\/","name":"OrbitSoft Blog","description":"Discover the latest in news and resources for OrbitSoft","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/orbitsoft.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/orbitsoft.com\/blog\/#\/schema\/person\/e515b3fa91e283750477594c4f028b7b","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/orbitsoft.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b1b269c579caf059f82b6d114c63fc49?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b1b269c579caf059f82b6d114c63fc49?s=96&d=mm&r=g","caption":"admin"},"url":"https:\/\/orbitsoft.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/posts\/35478"}],"collection":[{"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/comments?post=35478"}],"version-history":[{"count":21,"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/posts\/35478\/revisions"}],"predecessor-version":[{"id":36566,"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/posts\/35478\/revisions\/36566"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/media\/35599"}],"wp:attachment":[{"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/media?parent=35478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/categories?post=35478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/orbitsoft.com\/blog\/wp-json\/wp\/v2\/tags?post=35478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}