Aptitude or apt-get?

It’s 2017. I started using linux in 1999. Yes, I am getting older and older. I have always used apt-get on Debian based servers or distributions. However, in recent times, I am getting more frustrated to use apt-get. To be precise, I may want to install a package. So, I start to type apt-get. Then I may be unsure, if the package by the exact name exists. So, I tend to search the package/s, instead of installing it. Now, I have to use apt-cache to search packages. Sigh!

Conflict resolution

Installing MariaDB by replacing the default MySQL in the older Ubuntu distributions (14.04 or 12.04) have always been a pain. I tend to miss something that resulted in package conflict. In these situations, apt-get would simply throw me an error something similar to, “Sorry, I can’t allow you to do that“. Then, I would be like “wtf, why don’t you provide me a clue on what’s going on“. Just had a similar situation where aptitude resolved the issue swiftly. A big thanks for aptitude.

But, why do articles often show apt-get commands?

There might be two reasons.

  • On each of those articles, it has to start with apt-get install aptitude
  • It is easier to show the commands than GUI offered by aptitude

Both reasons are irrelevant these days when most server admins work only on CLI. Probably, it is time to start promoting aptitude in articles.

Are there any other difference between aptitude and apt-get?

Of course. There are some minor differences.

  • apt-get autoremove is done automatically by aptitude (saves time!)
  • aptitude’s safe-upgrade and full-upgrade commands are more accurate than apt-get’s upgrade and dist-upgrade.
  • even though aptitude’s search is way too slow than its competitor’s, it has some advanced search patterns that can come in handy at times.
  • apt-get is always faster!
  • apt-get uses smaller footprint than the other!
  • aptitude has why and why not!
  • apt-get came first! (so no chicken-or-egg issue here). You’ll always find apt-get in every Debian based distro, even on a super bare-bone server. But, it may not be true for aptitude!

Conclusion

In the end, it’s just a personal preference, I guess. Time for me to rewrite my muscle memory to use aptitude instead of apt-get or apt-cache!

Crooky Cron

What Is Cron?

In simple terms, cron is a job scheduler in unix-like operating systems. It is also called as system cron or OS cron especially if the discussion is also about WP Cron. The job can be anything that needs to be done at a particular time. The job could be an one-time job (such as launching a rocket at a scheduled time) or repetitive (such as turning the lights on upon sunset and turning them off upon sunrise, every day!). Basically, the system cron is a program that runs all the time just to trigger a particular action at a particular time. You can throw hundreds of tasks on it to do at various intervals. System cron is like robot who is always available at your service!

What is WP Cron?

WP Cron helps to do the following tasks (among others) in WordPress core…

  • Publishing scheduled posts
  • Checking for updates to WordPress core, plugins and themes
  • Applying updates (depending on the configuration)

Plugins can also utilise WP Cron to do various tasks…

  • Pulling the latest social media tweets to display on the site
  • Sending small batches of newsletters if your site has thousands of subscribers
  • Updating inventory based on external resources

WP Cron is like an on-call assistant. It means it doesn’t run jobs all the time. It runs jobs only when someone visits your site!

WP Cron was introduced because of the limitations on the hosts (such as shared hosts) where hosts don’t allow access to the system cron. At the same time, it was never meant to replace the system cron that is more precise in executing the tasks on time. WP Cron is meant to make sure that the tasks are done irrespective of when they are done. That’s the basic difference between the system cron and WP Cron.

The other is… WP Cron can only run with a minimum frequency of 5 minutes. The (OS) cron can run at a frequency of 1 minute. Also, using a system cron can help us to run any script. WP Cron is less flexible in this regards.

What’s the problem with WP-cron?

The advent of full page caching engines, such as WP Super Cache, prevented visitors hitting the WordPress (to be precise the PHP). Full page caching engines generate HTML files that can be served directly, if exists. With the recent development on preloading full page cache, it becomes even easier to generate cached version of a blog post immediately after it is published.

This is actually good news for everyone. It saves the precise server resources for host. It saves a few bucks too. It makes delivering content much faster, without having to process PHP and MySQL. But… it isn’t good news for WP Cron. WP Cron runs only when a visitors hits uncached version of the site, thus triggering PHP, MySQL and WordPress in turn. The result is too many WP cron tasks accumulated over a period of days, weeks or months, depending on how fierce your full-page caching engine is. At times, you may see thousands of cron jobs that just fill the database, reducing the overall performance of the backend.

Most common problem with WP Cron is that scheduled posts are not published on time. Again, it is due to aggressive caching system or lack of any visitors to the site. If you run a multisite, the problems are even bigger.

What’s the solution?

Simple. Let system cron trigger WP-Cron!

If your host doesn’t support (system) cron or if you want more features than what’s offered by your webhost, then head over to easycron.com, setcronjob.com or any similar external cron service. They support per minute cron jobs, notifications upon failures, offer logging to name a few.

Most managed WordPress hosts have built-in cron system to trigger WP Cron regularly. cPanel supports cron too. Even some regular generic web hosts support OS cron.

If your host supports cron, do yourself a favour by hiring a developer to setup the cron for you!

2013 Year in Review

We are already in 2014. However, it is probably the right time to take a look back at what happened last year.

Among so many things happened in 2013, the following come on top of my head. These events and products are related to performance, WordPress, security and other misc stuff. Please feel free to comment, if I missed anything.

Google Compute Engine became generally available in December 12, 2013. Continue reading “2013 Year in Review”

Fix Incorrect IP Address in WP Comments

Image of an IP logoThe cost of running a VPS is becoming cheaper and cheaper. There are more things we could get for the same bucks. Once your site is ready for a VPS, there are multiple server stack options available, than the traditional LAMP setup. For example, you could completely ignore Apache and can use Nginx with php-fpm . Either case, you wouldn’t have any issues related to IPs in comments. However, on a complicated setups, such as Varnish => Nginx => php-fpm or Nginx => Apache, or Varnish => Apache, WordPress doesn’t display the IP address of the visitors correctly. There is nothing wrong with WordPress. It’s all about the implementation. Forwarding the correct client IP can be tricky as the complexity of the server stack increases. There are situations where you just don’t have any options to forward the correct address. Continue reading “Fix Incorrect IP Address in WP Comments”

WordPress Backup Solutions

WordPress backup solutions!Do you have a backup strategy for your WordPress site?

If you have never asked the following questions to yourself, then this article is for you…

  • What to backup?
  • Where to backup?
  • How to backup?

This (not so) tiny article discusses the proper way to archive your data, shows the various options available to do the same. If you ever care about your WP powered site, take a minute to read further. Continue reading “WordPress Backup Solutions”

Google PR vs Page Speed

PageSpeed Logo

Update: As of April 2016, Google has shut down PageRank data to the public.

Google has repeatedly mentioned that site speed, load time and performance of a site does matter for Google on search engine rankings. While I’m not into SEO and I rarely cared about Google PageRank in particular, I have been in shock for the past 10 days or so, even since my Piwik statistics showing me that this site’s Google PR went from nil to 5!!!!! Yes, that f-i-v-e, five out of the maximum of 10! Continue reading “Google PR vs Page Speed”