<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rahul Nagare</title>
    <description>The latest articles on DEV Community by Rahul Nagare (@nginxreload).</description>
    <link>https://dev.to/nginxreload</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F311210%2F32181d17-549b-47be-b585-e4e41e694de9.jpg</url>
      <title>DEV Community: Rahul Nagare</title>
      <link>https://dev.to/nginxreload</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nginxreload"/>
    <language>en</language>
    <item>
      <title>Securing WordPress</title>
      <dc:creator>Rahul Nagare</dc:creator>
      <pubDate>Mon, 27 Jan 2020 16:18:29 +0000</pubDate>
      <link>https://dev.to/nginxreload/securing-wordpress-3ip2</link>
      <guid>https://dev.to/nginxreload/securing-wordpress-3ip2</guid>
      <description>&lt;p&gt;WordPress gets a bad rap when it comes to security. Because WordPress powers over 35% of the web, it is an attractive target for hackers, crackers, and script-kiddies alike. Review the web server logs of any WordPress site, and you’ll feel worse than after reading YouTube comments.&lt;/p&gt;

&lt;p&gt;When you run a high profile or high traffic WordPress site, it’s understandable that the hackers take an interest in it. But why do we see the same hack attempts on new WordPress sites running on a default theme with no content?&lt;/p&gt;

&lt;p&gt;More often than not, hackers are interested in the underlying server resources more than the site itself. If they can hack enough sites, those can be used to create an army of bots. Since most of these hack attempts are automated, it is cheaper and easier to try and hack every WordPress site rather than classifying active vs. dev sites.&lt;/p&gt;

&lt;p&gt;Think of it like the junk mail you receive for extended car warranty or insurance offers. It’s cheaper for the sender to bulk mail these letters to every household. Even if 0.1% of people respond, it still makes the scam profitable. Hackers use the same law of large numbers when trying to hack WordPress sites.&lt;/p&gt;

&lt;p&gt;Does this mean that WordPress is the wrong choice for enterprise sites?&lt;/p&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;Since most of the hack attempts are automated, we can block them with security measures that are essential for any content management system.&lt;/p&gt;

&lt;p&gt;WordPress hacks commonly fall in these categories:&lt;/p&gt;

&lt;p&gt;Brute force logins&lt;br&gt;
Plugin/theme exploits&lt;br&gt;
SQL Injections&lt;/p&gt;

&lt;p&gt;Brute force login attempts try to gain access to your site by trying commonly used username and password combinations. In the past, installing a plugin to block visitor IP after X failed attempts used to be sufficient. These days hackers rotate the IPs between login attempts to maximize chances of a successful login. We can stop these attacks effectively by switching to a whitelist based approach. By permitting admin access to a small list of approved IP addresses effectively blocks everyone else from accessing your site. If you use WooCommerce on your site, limiting access to a specified list of IPs for a certain number of critical user roles helps.&lt;/p&gt;

&lt;p&gt;A byproduct of implementing a whitelist is that it helps find any plugins that rely on admin-ajax.php functionality. Replacing these plugins with better alternatives helps protect your site against the next type of hack.&lt;/p&gt;

&lt;p&gt;Plugin and theme exploits are one of the reasons WordPress is considered insecure. With these, hackers try to use recent 0-day exploits to gain admin access to WordPress or install malware at scale. If you implement a whitelist to access wp-admin, some of these exploits are blocked automatically. For the rest, you can tweak your WAF to prevent direct access to .php files and block non-standard query strings.&lt;/p&gt;

&lt;p&gt;Finally, we look at SQL injections. These are one of the oldest exploits and have a permanent place on the OWASP top 10 application vulnerabilities. To effectively protect WordPress against SQL injections, we need to go beyond WAF rules. Making sure that your plugins and themes are sanitizing inputs is essential to a secure site. Routine code reviews and instilling a culture of security-first coding helps keep your mission-critical site safe against these exploits.&lt;/p&gt;

&lt;p&gt;While it’s true that no security measures are 100% effective, the ones listed here help you block most of the automated hacks. With a smaller attack surface, your WebOps team can work more effectively to protect your site.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>webdev</category>
      <category>security</category>
    </item>
    <item>
      <title>Scaling Webapps: Up vs Out</title>
      <dc:creator>Rahul Nagare</dc:creator>
      <pubDate>Fri, 17 Jan 2020 15:47:07 +0000</pubDate>
      <link>https://dev.to/nginxreload/scaling-webapps-up-vs-out-4n93</link>
      <guid>https://dev.to/nginxreload/scaling-webapps-up-vs-out-4n93</guid>
      <description>&lt;p&gt;As your web app starts to grow, there comes the point where current server resources are no longer sufficient. WordPress starts to slow down, there are occasional timeouts, and your marketing team has to limit their campaigns to avoid taking the site offline. At this point, you have a decision to make – scale-up or scale-out.&lt;/p&gt;

&lt;p&gt;Scaling up means adding more resources to the existing web server. In most cases, this refers to resizing the VM instance to the next available size. Scaling up is also called verticle scaling.&lt;/p&gt;

&lt;p&gt;Scaling up is easy, reasonably painless, and has minimal potential to break your site.&lt;/p&gt;

&lt;p&gt;But &lt;/p&gt;

&lt;p&gt;There is an upper limit on how much you can scale up. Although you can launch VMs with 128 GB memory and 32 CPUs these days, other bottlenecks show up way before you run out of memory. In other words, doubling the memory doesn’t double the capacity to serve visitors. The server starts to run out of available ports, sockets, and in case of containers, IP addresses as the traffic grows. Scaling up also doesn’t protect you against single-point-of-failure.&lt;/p&gt;

&lt;p&gt;On the plus side, scaling up keeps the deployment and ops workflows the same as before and doesn’t introduce any changes.&lt;/p&gt;

&lt;p&gt;Scaling out means splitting the traffic across several web servers. Scaling out is also called horizontal scaling. &lt;/p&gt;

&lt;p&gt;Scaling out is complex and requires extensive work to get started and to keep the site running smoothly. On the plus side, scaling out provides high-availability and significantly more capacity to serve visitors when done right.&lt;/p&gt;

&lt;p&gt;When you consider scaling out your infrastructure, you need a plan for the following areas that aren’t necessary with a single web server:&lt;/p&gt;

&lt;p&gt;Replicated file system to share code and media across web servers.&lt;/p&gt;

&lt;p&gt;Standalone database server accessible over the network&lt;/p&gt;

&lt;p&gt;SSL Termination and load balancing.&lt;/p&gt;

&lt;p&gt;Log aggregation.&lt;/p&gt;

&lt;p&gt;A deployment strategy with an optional blue-green deployment solution.&lt;/p&gt;

&lt;p&gt;So, which scaling method is right for you?&lt;/p&gt;

&lt;p&gt;If you expect the traffic to grow 2x this year, scaling up saves you from the complexity and overhead. All you need is a maintenance window where you can resize your server and adjust server configurations to utilize available resources effectively.&lt;/p&gt;

&lt;p&gt;If you expect the traffic to grow 10x this year, investing in scaling out is more effective. It requires careful planning, testing, and migration from the current server to the new cluster. But when done right, scaling out helps you grow an order of magnitude more compared to scaling up.&lt;/p&gt;

&lt;p&gt;If you don’t expect the traffic to change but need better availability for your site, consider this:&lt;/p&gt;

&lt;p&gt;Daily automated server snapshots in 2 regions and low TTL on your DNS server.&lt;/p&gt;

&lt;p&gt;If there is an extended outage, you can spin up a new VM in a different region using the daily snapshot, update the DNS, and get back online without the complexity of high-availability systems.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>linux</category>
    </item>
    <item>
      <title>Scaling WordPress: The Autoscaling Fallacy</title>
      <dc:creator>Rahul Nagare</dc:creator>
      <pubDate>Thu, 16 Jan 2020 22:36:19 +0000</pubDate>
      <link>https://dev.to/nginxreload/scaling-wordpress-the-autoscaling-fallacy-5377</link>
      <guid>https://dev.to/nginxreload/scaling-wordpress-the-autoscaling-fallacy-5377</guid>
      <description>&lt;p&gt;Busy sites need autoscaling. That’s what everyone expects, technical and non-technical users alike. The rising popularity of cloud computing has taught us to expect unlimited capacity for all online services.&lt;/p&gt;

&lt;p&gt;How does this apply to WordPress?&lt;/p&gt;

&lt;p&gt;A quick search returns hundreds of results that equate AWS with automatic infinite capacity. While AWS is no silver bullet, some of these results do recommend a scalable architecture.&lt;/p&gt;

&lt;p&gt;How does autoscaling actually work in the real world, though?&lt;/p&gt;

&lt;p&gt;In theory, an adequately configured stack keeps track of various resources, such as CPU, Memory, PHP workers, etc. When the utilization for any of these resources exceeds a predefined limit for more than a few minutes, stack launches another VM. This new VM is then used to serve the additional traffic. Stack repeats this process as long as there is enough traffic to warrant additional resources.&lt;/p&gt;

&lt;p&gt;Pretty cool, right?&lt;/p&gt;

&lt;p&gt;While this process looks great on paper, it’s a little less magical in reality. When the stack launches a new VM to serve additional traffic, it can take 60 to 120 seconds for it to become ready and join the load-balancer. A good web ops team knows this and utilizes various caches and queues to make this latency invisible to the end-user. Without such caches and queues in place, visitors experience timeouts, slowdowns, or random errors while new VMs are being prepared.&lt;/p&gt;

&lt;p&gt;Since autoscaling requires sustained heavy traffic to launch new VMs, it makes little sense to use it on smaller sites.&lt;/p&gt;

&lt;p&gt;Time for a car analogy.&lt;/p&gt;

&lt;p&gt;F1 cars are built for massive speed. But if you try diving an F1 car on slow speed, it doesn’t generate enough downforce to provide decent traction, the breaks aren’t warm enough to be useful, and the handling is tricky at best.&lt;/p&gt;

&lt;p&gt;To get around some of these issues, the F1 crew pre-warms the tires, uses a starter motor to start the engine, and has the skills to handle any pit stops as quickly as possible.&lt;/p&gt;

&lt;p&gt;When it comes to operating an autoscaling environment for WordPress, you do need similar systems in place. A process to warm up the load balancer, a way to spin up additional VMs, and a star crew that maintains the pit stops. There are just too many moving parts for autoscaling to “just work” automatically.&lt;/p&gt;

&lt;p&gt;When you are shopping for an autoscaling solution, ask the providers on your shortlist these questions:&lt;/p&gt;

&lt;p&gt;What’s your plan to minimize the latency while new VMs starting?&lt;br&gt;
Will I be able to launch more VMs in advance if there is not enough traffic yet?&lt;br&gt;
Will I be able to control the thresholds when autoscaling launches additional VMs?&lt;/p&gt;

&lt;p&gt;And finally,&lt;/p&gt;

&lt;p&gt;Will I be able to contact the crew that set this up directly when I’m expecting a traffic surge?&lt;/p&gt;

&lt;p&gt;These questions will help you look past the marketing speak and save a lot of stress down the line.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>wordpress</category>
      <category>devops</category>
      <category>webperf</category>
    </item>
    <item>
      <title>Going Beyond Uptime Monitoring</title>
      <dc:creator>Rahul Nagare</dc:creator>
      <pubDate>Tue, 14 Jan 2020 19:43:14 +0000</pubDate>
      <link>https://dev.to/nginxreload/going-beyond-uptime-monitoring-2kj9</link>
      <guid>https://dev.to/nginxreload/going-beyond-uptime-monitoring-2kj9</guid>
      <description>&lt;p&gt;In 2020 it is common knowledge that slow websites poorly affect revenue, brand loyalty, and conversions. Do you know what impacts conversions even more?&lt;/p&gt;

&lt;p&gt;Outages!&lt;/p&gt;

&lt;p&gt;An unreachable website can’t generate new conversions, revenue, or brand loyalty.&lt;/p&gt;

&lt;p&gt;There are a wide variety of services that help monitor WordPress sites from different locations in the world. Most of these services access your site every minute and generate an alert if the site is unreachable. While you can’t go wrong with any of these services, I prefer uptimerobot. The number of false positives is minimal with uptimerobot, plus they have a generous free tier.&lt;/p&gt;

&lt;p&gt;Uptime monitoring, in combination with server alerts, is sufficient for most small to medium-sized sites. Afterall there aren’t many things that can go wrong on a single-server setup.&lt;/p&gt;

&lt;p&gt;But what happens as your site grows and you move to a distributed setup?&lt;/p&gt;

&lt;p&gt;Imagine scaling your site across 200 containers on Kubernetes. 198 of these containers are healthy. Remaining two containers, while active, are returning HTTP 200 responses with white pages to all visitors. In other words, most visitors and uptime monitoring services can access your site just fine, but a small number of visitors see blank pages.&lt;/p&gt;

&lt;p&gt;How do you find out about the two faulty containers? You can’t wait for visitors to complain, only to have the Ops team respond, “It works on my machine!”.&lt;/p&gt;

&lt;p&gt;This is where you need to go beyond uptime monitoring. In high-availability and distributed hosting environments, transaction monitoring becomes essential.&lt;/p&gt;

&lt;p&gt;You can do this using a combination of real user monitoring (RUM) and APM insights using a service like New Relic.&lt;/p&gt;

&lt;p&gt;RUM monitors and logs each visitor’s browser timing. RUM helps measure website response time across different browsers, regions, and devices. APM is integrated with PHP to analyze, profile, and logs each transaction. APM helps you measure the response time for uncached pages on your site and transactions such as signups, checkouts, and more.&lt;/p&gt;

&lt;p&gt;Services like New Relic support setting up custom events for RUM and APM. For example, you can set up an alert if the response time is more than 3 seconds for any visitor or if the bytes transferred are below 1 Kb for logged-in users.&lt;/p&gt;

&lt;p&gt;Utilizing RUM + APM based monitoring can help you catch edge cases and significantly minimize the troubleshooting time. Throw container monitoring in the mix, and you get excellent visibility into the high-availability environment that powers your site.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>wordpress</category>
      <category>webdev</category>
      <category>devops</category>
    </item>
    <item>
      <title>5 Myths about WordPress Backups</title>
      <dc:creator>Rahul Nagare</dc:creator>
      <pubDate>Mon, 13 Jan 2020 21:35:42 +0000</pubDate>
      <link>https://dev.to/nginxreload/5-myths-about-wordpress-backups-mgl</link>
      <guid>https://dev.to/nginxreload/5-myths-about-wordpress-backups-mgl</guid>
      <description>&lt;p&gt;Everyone agrees that backups are essential. Not only for websites but also for desktops, laptops, phones, and even git repositories. Yet, when it comes to protecting mission-critical WordPress sites, the backup solutions in place are often inadequate.&lt;/p&gt;

&lt;p&gt;More often than not, these backup shortcomings are a result of myths and assumptions about the underlying infrastructure your site runs on. Here are several myths I come across when onboarding new clients.&lt;/p&gt;

&lt;p&gt;Myth 1: My site uses EBS, which is replicated across multiple servers. I don’t need backups.&lt;/p&gt;

&lt;p&gt;While it’s true that EBS volumes are replicated across multiple servers, they are not protected against any file changes or deletions done by the user. Failed WordPress updates, user error, or malware can alter files on your server. If you don’t have a backup solution in place, EBS can’t recover file changes or restore older versions on demand.&lt;/p&gt;

&lt;p&gt;Myth 2: I store my media on S3. I don’t need backups.&lt;/p&gt;

&lt;p&gt;Similar to EBS, storing WordPress uploads on S3 is also not an alternative to backups. Without backups, any files deleted from wp-admin even by mistake are lost forever. One caveat to this is if you enable versioning on your S3 bucket, it protects against file changes and deletions. Remember that this is not enabled by default. If your site offloads static assets to S3, make sure that versioning is enabled and working as expected.&lt;/p&gt;

&lt;p&gt;Myth 3: AWS takes snapshots of my server. I don’t need backups.&lt;/p&gt;

&lt;p&gt;While snapshots are better than not having any backups, restoring them is time-consuming and costly. Imagine your team asking for a copy of wp-config.php from last week. Backup archives can selectively restore this one file in seconds. Server snapshots, on the other hand, need to be restored entirely on a new volume before any files are accessible. If you restore server snapshots on a new instance, there is a risk of wp-cron altering the database with stale values. Snapshots also make local development difficult compared to backup archives.&lt;/p&gt;

&lt;p&gt;Myth 4: I don’t need to backup dev sites.&lt;/p&gt;

&lt;p&gt;While chances of data loss on development sites are smaller compared to production, these sites should still have a backup solution in place. Development site backups enable developers to rollback 3rd party libraries to previous versions when things go wrong. Backups also protect against dependencies that are no longer available on public repositories, software bugs that result in malformed artifacts, and more.&lt;/p&gt;

&lt;p&gt;Myth 5: I don’t need to backup git repositories&lt;/p&gt;

&lt;p&gt;Git repos are distributed by design. Most teams also sync with git hosting services such as Github or Gitlab. So does it make sense to backup git repositories? In a high-availability environment, git hooks are often used for various post-deployment tasks. These hooks are not present on developers’ local repos or Github. Having a backup of the git repository on the server protects these hooks in case of a disaster. Git backups are a lifesaver in the event of cloud and SaaS outages.&lt;/p&gt;

&lt;p&gt;A good backup strategy contains the following three elements:&lt;/p&gt;

&lt;p&gt;Frequency: Backup frequency should be adjusted depending on how frequently your site and database change.&lt;/p&gt;

&lt;p&gt;Destination: Backups should be stored in at least 2 separate regions to protect against any cloud outages.&lt;/p&gt;

&lt;p&gt;Verification: Backups should be tested periodically to ensure the integrity of the archives.&lt;/p&gt;

&lt;p&gt;Once you have a backup policy in place, you can start looking into the performance impact and overhead of your strategy.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>webdev</category>
      <category>aws</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>Scaling WordPress: Apache vs Nginx vs Apache+Nginx</title>
      <dc:creator>Rahul Nagare</dc:creator>
      <pubDate>Fri, 10 Jan 2020 21:38:24 +0000</pubDate>
      <link>https://dev.to/nginxreload/scaling-wordpress-apache-vs-nginx-vs-apache-nginx-47e6</link>
      <guid>https://dev.to/nginxreload/scaling-wordpress-apache-vs-nginx-vs-apache-nginx-47e6</guid>
      <description>&lt;p&gt;When it comes to scaling any PHP application, this is a common question. Apache or Nginx or Apache with Nginx? I think this is as important a question as tabs vs. spaces.&lt;/p&gt;

&lt;p&gt;Apache gets much hate for not being scalable or reliable. This hate comes from the old days of poor defaults and mod_php. With mod_php, apache spawns a PHP parser even when static files are requested, and that results in higher memory usage per child process. In other words, you end up using ~200 MB memory when processing WordPress files and another ~200 MB memory to serve each image that goes along with the site.&lt;/p&gt;

&lt;p&gt;Throw this configuration in a high traffic situation, and like clockwork, it crashes when the memory runs out.&lt;/p&gt;

&lt;p&gt;In reality, apache httpd powers popular sites like apple.com and adobe.com. If you use php-fpm with httpd, it scales very well for WordPress, and you get to keep your .htaccess rules.&lt;/p&gt;

&lt;p&gt;Nginx uses php-fpm by default with the fastcgi_pass mechanism. This gives it an edge in the benchmarks when compared against apache with mod_php.&lt;/p&gt;

&lt;p&gt;If you compare Nginx and Apache side by side with both using php-fpm, the results are almost identical.&lt;/p&gt;

&lt;p&gt;So which one is better?&lt;/p&gt;

&lt;p&gt;Well, it comes down to the team that needs to support this site regularly. If the team is comfortable with httpd, go for it. If they are comfortable with nginx, use that instead.&lt;/p&gt;

&lt;p&gt;Some people like to use nginx in front of httpd to serve static files and let apache handle php requests. While this provides the best of both worlds, I prefer keeping my stacks lean. Lean stacks make troubleshooting easier when things go wrong.&lt;/p&gt;

&lt;p&gt;One argument I hear a lot against using only nginx is that you don’t get to use .htaccess, which may break WordPress plugins.&lt;/p&gt;

&lt;p&gt;I manage ~15,000 wp sites, and for 99% of them, the following nginx config is enough to replace htaccess:&lt;/p&gt;

&lt;p&gt;location / {&lt;br&gt;
try_files $uri $uri/ /index.php?$args;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;For anything else more complicated, offloading it to 3rd party services (WAFs, CDNs) scales better.&lt;/p&gt;

&lt;p&gt;The bottom line is you can get identical performance with Apache or Nginx when using php-fpm. Go with the one you are comfortable with and look for optimizations on another layer. Unless there is a clear need for it, avoid apache+nginx and keep your stack lean.&lt;/p&gt;

&lt;p&gt;P.S.: Apache httpd has come a long way from its mod_php days. You can even use Lua scripts with httpd just like Nginx and Resty!&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>linux</category>
      <category>webperf</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Scaling WordPress: Using wp-cli for WebOps</title>
      <dc:creator>Rahul Nagare</dc:creator>
      <pubDate>Thu, 09 Jan 2020 17:24:58 +0000</pubDate>
      <link>https://dev.to/nginxreload/scaling-wordpress-using-wp-cli-for-webops-31gc</link>
      <guid>https://dev.to/nginxreload/scaling-wordpress-using-wp-cli-for-webops-31gc</guid>
      <description>&lt;p&gt;Maintaining a high traffic WordPress or WooCommerce site takes a lot of work. While automation takes care of tasks such as log rotation, daily backups, and monitoring, ongoing performance optimization still requires manual attention.&lt;/p&gt;

&lt;p&gt;When you are working on a mission-critical WordPress site, you can’t install plugins for operational tasks without risking outages or performance drop. As you know, plugins can be a liability on high-traffic sites.&lt;/p&gt;

&lt;p&gt;This is where wp-cli comes in handy. Wp-cli is the command line interface for WordPress. It uses the REST API and provides functionality that would otherwise require plugins or code snippets.&lt;/p&gt;

&lt;p&gt;Wp-cli is quite useful in high-availability environments because you can use it with PHP-CLI without blocking any php workers. Another upside to using wp-cli instead of plugins is that php-cli has an unlimited execution time with no timeouts by default. This means that if you need to run a query on a large dataset, wp-cli can handle it without timing out halfway.&lt;/p&gt;

&lt;p&gt;Here are a few examples where WebOps teams can utilize wp-cli:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Manage wp-cron:&lt;/strong&gt;&lt;br&gt;
Wp-cli provides better control over cron events. This means you can run specific cron events as needed instead of merely calling wp-cron.php and letting it timeout while clearing expired transients.&lt;/p&gt;

&lt;p&gt;This command can execute all pending events without timing out after 60 seconds:&lt;br&gt;
&lt;code&gt;wp cron event run –due-now&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Delete expired transients:&lt;/strong&gt;&lt;br&gt;
While expired transients should delete automatically and keep the wp_options table lean, sometimes it is essential to delete them more frequently. Poorly coded plugins generate transients that stick around for longer than necessary, and the following command can get rid of them:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wp transient delete –expired&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you need to delete all transients, this command helps:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wp transient delete –all&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regenerate Thumbnails:&lt;/strong&gt;&lt;br&gt;
Instead of adding a plugin to regenerate thumbnails (And slowing down wp-admin), following command can do it for you more effectively:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wp media regenerate&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To selectively regenerate thumbnails you can pass the attachment id or instruct wp-cli to regenerate all missing thumbnails:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wp media regenerate &amp;lt;attachment-id&amp;gt; --only-missing&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database operations:&lt;/strong&gt;&lt;br&gt;
Wp-cli uses the db credentials specific in wp-config.php and provides an easy interface for routine database operations. This comes in handy when you are using RDS, Aurora or other remote MySQL solution where the hostname is complex, and you would rather not keep typing it for each operation.&lt;/p&gt;

&lt;p&gt;DB Export:&lt;br&gt;
&lt;code&gt;wp db export &amp;lt;filename&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;DB Import:&lt;br&gt;
&lt;code&gt;wp db import &amp;lt;filename&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;DB Reset:&lt;br&gt;
&lt;code&gt;wp db reset&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;DB Repair:&lt;br&gt;
&lt;code&gt;wp db repair&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;DB Optimization:&lt;br&gt;
&lt;code&gt;wp db optimize&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;User Management:&lt;/strong&gt;&lt;br&gt;
WebOps teams need to create users with different roles from time to time to test wp-admin functionality. Wp-cli makes it easy, secure, and fast:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wp user create demouser wp@demo.com --role=editor&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once you are done with the user account, you can delete it with this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wp user delete demouser&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cache Management:&lt;/strong&gt;&lt;br&gt;
Wp-cli can manipulate the object-cache without requiring any separate plugins.&lt;/p&gt;

&lt;p&gt;To quickly purge the object-cache, this command helps:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wp cache flush&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Core and Plugin updates:&lt;/strong&gt;&lt;br&gt;
Wp-cli can update the core and plugins from the command line:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wp core update&lt;/code&gt;&lt;br&gt;
&lt;code&gt;wp plugin update --all&lt;/code&gt;&lt;br&gt;
&lt;code&gt;wp plugin update wordpress-seo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The ability to run non-interactively, single .phar binary, and extensibility using modules makes wp-cli a great tool for deployment and ops automation.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>webdev</category>
      <category>linux</category>
      <category>bash</category>
    </item>
    <item>
      <title>Scaling WordPress: Latency vs Throughput</title>
      <dc:creator>Rahul Nagare</dc:creator>
      <pubDate>Wed, 08 Jan 2020 17:35:56 +0000</pubDate>
      <link>https://dev.to/nginxreload/scaling-wordpress-latency-vs-throughput-4la5</link>
      <guid>https://dev.to/nginxreload/scaling-wordpress-latency-vs-throughput-4la5</guid>
      <description>&lt;p&gt;When scaling WordPress sites, one of the first things people try is adding more hardware. Unless this is a proven bottleneck in the stack, this added hardware capacity is often left idle only to be used by various buffers and caches later.&lt;/p&gt;

&lt;p&gt;So how do you do capacity planning for large WordPress sites? At Scale Dynamix, we like to think of it in terms of latency and throughput.&lt;/p&gt;

&lt;p&gt;Roughly speaking, latency is how fast the site loads for one visitor. Throughput is how many visitors can access the same site at the same time. If latency is too high, adding more hardware makes little difference.&lt;/p&gt;

&lt;p&gt;Imagine you are going on a road trip. To avoid traffic, you leave at 2 am and have all six lanes of the interstate to yourself.&lt;/p&gt;

&lt;p&gt;But…&lt;/p&gt;

&lt;p&gt;You are driving a Toyota Yaris! Would adding another lane on the freeway make you go faster? Of course not.&lt;/p&gt;

&lt;p&gt;Similarly, if WordPress is slow for one visitor while most of the CPU is idle, adding more hardware won’t make much difference.&lt;/p&gt;

&lt;p&gt;This is why the right starting point when scaling WordPress is latency reduction. Making sure the site loads as fast as it can for one visitor helps when you are ready to open the floodgates and start serving thousands of visitors per minute.&lt;/p&gt;

&lt;p&gt;Having said this, I would choose an empty freeway and a Yaris over a congested road and a BMW any day.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>wordpress</category>
      <category>webdev</category>
      <category>webperf</category>
    </item>
    <item>
      <title>Scaling WordPress: AWS is no silver bullet</title>
      <dc:creator>Rahul Nagare</dc:creator>
      <pubDate>Tue, 07 Jan 2020 20:24:35 +0000</pubDate>
      <link>https://dev.to/nginxreload/scaling-wordpress-aws-is-no-silver-bullet-1kel</link>
      <guid>https://dev.to/nginxreload/scaling-wordpress-aws-is-no-silver-bullet-1kel</guid>
      <description>&lt;p&gt;There is a common misconception that hosting WordPress on AWS makes it scalable automatically. Every online WordPress community I visit has a fair number of posts asking about solutions for a growing site. 10 out of 10 times, these posts have a suggestion that says, “If you need scalable infrastructure, AWS is the only option.”&lt;/p&gt;

&lt;p&gt;Suggestions like this lead to a scenario we often see when onboarding new customers at Scale Dynamix. It goes something like this:&lt;/p&gt;

&lt;p&gt;The site starts to grow and runs into scaling troubles. Developers suggest a CDN. When the site still has issues, management decides to move the site to AWS. &lt;/p&gt;

&lt;p&gt;At this point, either the IT dept., or the agency managing WordPress launches a new EC2 instance. Since AWS recommends using Bitnami’s WordPress AMIs, most people go with that.&lt;/p&gt;

&lt;p&gt;While these EC2 images are an excellent way to launch development environments, using them in production doesn’t provide any of the scalability or high-availability features that AWS offers. In other words, users trade their bare-metal servers and VPSs in favor of EC2 VMs and are no better off than before. And now, they also need to have a plan for backups, security, and staging sites (Most AMIs only support one WordPress install).&lt;/p&gt;

&lt;p&gt;Here’s how I like to design a scalable and highly-available stack for WordPress using AWS: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start with appropriately sized EC2 instances (At least two).&lt;/li&gt;
&lt;li&gt;Use an application load balancer to route traffic across instances.&lt;/li&gt;
&lt;li&gt;Use RDS / Aurora for database hosting. A separate database server facilitates horizontal scaling of web nodes.&lt;/li&gt;
&lt;li&gt;Offload static assets to S3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With a stack like this, you can add more EC2 instances as the traffic increases and delete them as needed. Elastic Beanstalk can handle this automatically if the traffic is highly variable.&lt;/p&gt;

&lt;p&gt;You can make this stack more reliable and cost-effective by using multiple availability zones for EC2 and using spot instances to handle traffic spikes.&lt;/p&gt;

&lt;p&gt;Granted, this is more work, but it helps WordPress scale a lot further than using a pre-created image meant for prototype sites.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>wordpress</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
