Search Results

How Much Food Should You Have In Your Longterm Food Cache?

So the SHTF and you have successfully bugged in or bugged out according to your contingency plans. Now what? Is this going to be a longterm crisis due to war, asteroid strike or solar flare EMP? What is longterm for you…a couple weeks, months or several years?

I suggest that there are three distinct duration intervals for which you should stock supplies:

72 Hour Events

Something has happened while you are at work, school or stuck at home. It may be a riot, power outage or minor earthquake. You may need to use your BOB, GHB or GOOD kits to get home or stay at home until the crisis passes. Most people already have food and beverages at home to make it through a three day event. Of course food is just one supply that is needed to survive. In winter, sufficient heating is critical and power, lighting, communications are important at anytime.

Multi-Week Events

Recently there have been several events affecting people in the United States that impacted their lives for weeks and months at a time. Winter blackouts have lasted for weeks on end and are often combined with lack of running water, no heating and impassable secondary roads to suburbs. Floods and hurricanes often destroy houses, clothing, vehicles and much needed supplies such as food. These events often call for relocation to a BOL (Bugout Location) where you have put away supplies in advance or to a prepared relative’s home several hundred miles away from the impact area.

Longterm Events

The devastation of war, catastrophic natural disasters and economic collapse can make your current home and lifestyle into nothing more than a memory. The Tsunami of 2004 and New Orleans Katrina Flooding are two examples of events that leave the survivors with nothing but the clothes on their back and no choice but to relocate and start over. This migration and rebuilding can take years to complete and many survivors will be refugees relying on others for assistance for much of their lives.

How do you prepare for a longterm event? Can you trust that your supplies will be safe and available in your current home? Should you split your supplies across several locations to hedge against the impact of the possible disaster? What can you do now to prepare for the recovery and rebuilding of your life?

Those with unlimited financial resources, can buy bunkers and stock them with all imaginable types of supplies to last for decades. But for most people that work just to get by with perhaps only a paycheck or two between their current lifestyle and bankruptcy, each decision and purchase towards longterm preparation has to be beneficial by cost and ultimate value.

Ideally, you should have a bugout location already identified and stocked with basic supplies. This could be a vacation property, family farm or the home of a relative. The bare minimum supplies for a bugout location are food and water to support the number of people and length of time needed.

For just a family of four over a year’s time, that will be a lot of food and water. It’s possible to buy and put away that amount of food but it is costly and actually takes some room to store. Can you live off of stored food indefinitely? Obviously, no you can’t. If the infrastructure that you use to acquire food is broken or unavailable to you, how do you feed yourself?

Well, we can look to the 19th century for the solution. Small scale farming and keeping of animals will be the lifestyle post-SHTF.

If you are at your BOL longer than a year and committed for the near future to that location, then gardening and farming should become your new occupation. A couple of acres of land can produce a great deal of food. You should plant a variety of foods to take advantage of seasonality and nutrition.

Now if you start farming and raising animals in year two of your new life, there won’t be much food produced until the following year. If there is bad weather, flooding or disease you might lose most of the production from that year.

You should prepare to live off of your food cache for at least two years to give your new farming and ranching efforts a chance to bear fruit. The first year of cache is just to get you over the initial devastation of the longterm event and the second year is to feed you while you are busy transforming your BOL into a self-sustaining farm.

What should go into your two year cache? It turns out that an adult needs over 2,000 calories per day to maintain their current weight and health. If you are active during the day, you should actually double that requirement.

How do calories equate to the volumes of food that you can purchase by the pound or gallon? Well, it varies by the food type, but generally a serving as documented on food packaging is about 250 calories. That would be two and half cups of rice, or a cup of beans, or a can of chili. Each of those servings is about one pound in weight after preparation.

Here’s a good food storage calculator provided by the LDS:

As you can see, a single adult requires about five hundred (500) pounds of varied food per year. If you focus equally on white rice, pinto beans, rolled oats and canned meats, you should have the right mix of food staples to survive.

In order to add some variety and supplement your required intake of nutrients and minerals, you should also include a case each of real maple syrup, domestic honey (not from China), iodized salt, black pepper, assorted spices and powdered drink mixes.

This food cache needs to be purchased and stored at your BOL ahead of time. Most of the items I suggest have near indefinite storage lengths, if kept cool, dry and airtight. Rice and pinto beans will last for decades, while honey and salt have been discovered to last for THOUSANDS of years.

You can supplement your food staples with freeze-dried and nitrogen packed foods that come in various flavors and meals. These are often more expensive than the bulk staples, but may be worth it to you by providing some mental and emotional health benefits. Macaroni and cheese or tuna casserole are great comfort foods that the family can enjoy while settling into their new lives.

Given that a one (1) pound bag of rice or a can of chili seem to be going for about a $1.00 nowadays, it is reasonable to estimate that the cost per person per year will be about $500.00. If you look for sales and buy in bulk, you should be able to come down from that by as much as 25% or more.

You don’t have to buy all of that food at once! Get into a routine of double buying when you go to the grocery each week. Look for sales and deals and buy then. If you keep at it, you’ll be surprised how soon you will have six (6) months or even a year stored up already!

Speeding PHP Using APC PHP Cache

If you look at a PHP source file you will notice one thing. It’s a source file. Not particularly surprising, but think about when you deploy a PHP application, what do you deploy? PHP source files. Now for many other languages; Java, C, etc when you deploy an application you deploy the compiled file. So, the question that you want to ask yourself is this, how much time does a PHP application spend compiling source files vs running the code? I’ll answer that for you, a lot.

There are advantages to being able to deploy source files though. It makes it easy to do on the fly modifications or bug fixes to a program, much like we used to do in the early BASIC languages. Just change the file and the next time it’s accessed your change is reflected. So, how do we keep the dynamic nature of PHP, but not recompile our files every time they are accessed?

A PHP cache. It’s surprising to me that this concept isn’t built into the base PHP engine, but perhaps that’s because some company’s can sell this add on to speed up PHP. Luckily for us, some companies/open source projects provide this plug in to PHP at no charge. These plug ins are generally known as PHP accelerators, some of them do some optimization and then caching and some only do caching. I’m not going to pass judgement on which one is the best, any of them are better than nothing, but I decided to use APC, the Alternative PHP Cache. I chose this one because it is still in active development and is open source and free.

Alternative php cache can be found at, just look down the left column for APC. It comes in source form, so you will need to compile it before installing it, don’t worry about that part. If you’re using Red Hat 4 or CentOS4 I’ll tell you exactly how to do it. If you’re using something else, you’ll need the same tools, but getting the tools might be a bit different.

1. The Tools

Do you know how many web sites, forums and blogs I went to with my error messages before I found the answers as to what I was missing when I was trying to install APC – Alternative PHP Cache? Two days worth, but I finally found the correct combination and it’s really quite obvious as is everything once you know the answer. There are three sets of dev tools that you will need.

1a. You’ll need a package called “Development Tools” this will include all the important dev tools like the GCC compiler, etc.

1b. You’ll need a package called php-devel which as you might guess are development tools for PHP

1c. You’ll need a package called httpd-devel which of course are dev tools for Apache web server.

On Red Hat or CentOS getting these should be as easy as the following 3 commands:

yum groupinstall “Development Tools”

yum install php-devel

yum install httpd-devel

You’ll do these three one at a time and follow any instructions (usually just saying yes).

Now it’s time to follow the instructions contained in the APC package. Since these may change over time I’m not going to go through them. They are very complete. If you follow the instructions and get an file out of it, then you’re all set, just modify your php.ini file and you’re good to go.

There are two problems that I encountered that you may encounter too. The first is an error when running phpize. I ignored this error and everything succeeded okay, but not before I spent hours looking for the solution to this error. Here is the error. warning: underquoted definition of PHP_WITH_PHP_CONFIG

run info ‘(automake)Extending aclocal’

or see warning: underquoted definition of PHP_EXT_BUILDDIR warning: underquoted definition of PHP_EXT_DIR warning: underquoted definition of PHP_EXT_SRCDIR warning: underquoted definition of PHP_ALWAYS_SHARED

acinclude.m4:19: warning: underquoted definition of PHP_PROG_RE2C

People would have had me updating my PHP version from 4.3.9 and everything else under the sun to get rid of this error, but in the end it didn’t matter. My APC compiled and installed nicely and I am good to go.

The other slight problem that I ran into was the location of php-config. The install instructions wanted me to do the following:

./configure –enable-apc-mmap –with-apxs

However my php-config is in /usr/bin/php-config. Making that change allowed this part to work.

So, have at it, once it’s done you can expect to see huge improvements in your web site response times and reductions on your CPU load. One more quick note, My server hosts about 20 web sites, but only 3 or 4 are really busy. To reduce the memory footprint of caching everything for all 20 sites I used the apc.filters property. Although this property is slightly flawed for non qualified includes, it worked nicely for my Serendipity blogs. Your mileage with this property will vary according to the software you are using and how it does it’s includes.

Web Content Caching Explained

The minefield that is web content caching can be confusing and complicated!

It’s one of those features that really sits between the network and the application. In many businesses this grey area has no real ownership and as such, mistakes are often made.

I want to take a little time to explore and hopefully simplify this complex area.

So firstly one must address the question of what is a content cache and why bother using it?

A content cache is a piece of software or an appliance designed to sit in front of the application server. Its job is to intercept certain requests and respond on behalf of the application thus reducing the number of hits sent to the backend severs.

Typically the requests that are intercepted have already been seen before, so the cache will store responses to these requests and if it intercepts a similar request it can respond in the same way.

A simple example would be an image cache. The client (ie browser) would make a response to the web server for an image. The first time this image is requested the cache will have to get it from the web server however for subsequent requests it will simply serve it directly.

The idea is that the web server will have a lot less work to do as the cache can serve a lot of the content. The implications of this really depend on the exact setup, application and content however they typically fit into the following:

1. Reduce load on the web/application servers – Save on application server hardware and licensing costs.

2. Reduce load on middleware and Backed DB systems.

3. Serve the content faster – Caches can be very fast!

4. Cache the content closer to your users. This is an interesting one. The cache does not always have to be at the same location as the rest of the system. You could use a good cache to build your own simple content distribution system to ensure your users get the content from a source as close to them as possible. Who said that a CDN (Content Distribution Network) has to cost the earth!

OK so you have decided that you may want to use a cache, so what next? The biggest problem with content caching is simply deciding what and for how long you want to cache content for. It sounds simple but failure to do this in the past has given many a network manager / application owner a genuine fear of caching. You don’t want one user getting the account balance of the previous user!

However to really make the most of the capabilities that a modern content cache can offer we must understand the full picture. The application behaviour, the cache setup and the browser behaviour.

Let us take a quick look at typically what happens when an image is requested from a web server by a browser.

1. The user requests an image to look at.

2. The Cache will notice that it has not seen this request before and therefore will request it from the web server.

3. The web server will get the image and send it back to the cache.

Important. The web server will decide if this image can be cached or not. It will instruct the upstream devices such as the cache and ultimately the client if it should be cached it or not. It does this by using specific HTTP header. (I won’t geek out on this, in this article as it can get overly complex.)

4. Now it gets interesting because the cache will need to decide on which way to go. Does it obey the rules from the web server or does it override it with its own rules? We will discuss this later on.

5. So the image is now sent back to the client and just to complicate things the client will also cache the content and also look out for the cache control header.

So we can see that not only do we have to decide on the application caching rules but also how we want the cache to behave upstream. If we do this right we can even reduce the number of hits reaching the cache and thus network in the first place.

So now we have a rough idea of what is going on, so how do we implement a cache?

A general method is described in “light” detail below.

1. Decide what you want to cache and for how long – So I want to cache all images for 24hours or all *.asp for 2seconds etc. These can get complicated.

2. Be certain you are happy with these rules.

3. Now check again.

4. Configure the cache to remove all cache control headers from the response from the web server. In other words ignore any caching control setup on the webserver – We assume we know how to create more accurate set of rules.

5. Configure the cache with these new rules and also expiry dates/ durations.

6. Configure the cache to add some new cache controls for the Client. Client side cache control is tough as browsers respect these rules with varying degrees of success. This is not really in the scope of this paper but I may revisit it.

7. Document – These rules can be complex and can involve speaking to people in different parts of the business to understand the application, therefore it’s worth documenting this info whilst it is fresh.

8. Test and test again – The more testing the better. Remember part of testing is to manually empty the content cache’s cache but also the client’s too.

That’s it for now folks.

I am writing a follow up on this talking in a little more detail about typical cache settings and also helping to answer questions such as, ‘will a cache be of any help for my application and if so what type of cache should I be looking at?’