How Does the CPU Cache Work?

The cache on your CPU has become a very important part of today’s computing. The cache is a very high speed and very expensive piece of memory, which is used to speed up the memory retrieval process. Due to its expensive CPU’s come with a relatively small amount of cache compared with the main system memory. Budget CPU’s have even less cache, this is the main way that the top processor manufacturers take the cost out of their budget CPU’s.

How does the CPU Cache work?

Without the cache memory every time the CPU requested data it would send a request to the main memory which would then be sent back across the memory bus to the CPU. This is a slow process in computing terms. The idea of the cache is that this extremely fast memory would store and data that is frequently accessed and also if possible the data that is around it. This is to achieve the quickest possible response time to the CPU. Its based on playing the percentages. If a certain piece of data has been requested 5 times before, its likely that this specific piece of data will be required again and so is stored in the cache memory.

Lets take a library as an example o how caching works. Imagine a large library but with only one librarian (the standard one CPU setup). The first person comes into the library and asks for Lord of the Rings. The librarian goes off follows the path to the bookshelves (Memory Bus) retrieves the book and gives it to the person. The book is returned to the library once its finished with. Now without cache the book would be returned to the shelf. When the next person arrives and asks for Lord of the Rings, the same process happens and takes the same amount of time.

If this library had a cache system then once the book was returned it would have been put on a shelf at the librarians desk. This way once the second person comes in and asks for Lord of the Rings, the librarian only has to reach down to the shelf and retrieve the book. This significantly reduces the time it takes to retrieve the book. Back to computing this is the same idea, the data in the cache is retrieved much quicker. The computer uses its logic to determine which data is the most frequently accessed and keeps them books on the shelf so to speak.

That is a one level cache system which is used in most hard drives and other components. CPU’s however use a 2 level cache system. The principles are the same. The level 1 cache is the fastest and smallest memory, level 2 cache is larger and slightly slower but still smaller and faster than the main memory. Going back to the library, when Lord of the Rings is returned this time it will be stored on the shelf. This time the library gets busy and lots of other books are returned and the shelf soon fills up. Lord of the Rings hasn’t been taken out for a while and so gets taken off the shelf and put into a bookcase behind the desk. The bookcase is still closer than the rest of the library and still quick to get to. Now when the next person come in asking for Lord of the Rings, the librarian will firstly look on the shelf and see that the book isn’t there. They will then proceed to the bookcase to see if the book is in there. This is the same for CPU’s. They check the L1 cache first and then check the L2 cache for the data they require.

Is more Cache always better?

The answer is mostly yes but certainly not always. The main problem with having too much cache memory is that the CPU will always check the cache memory before the main system memory. Looking at our library again as an example. If 20 different people come into the library all after different books that haven’t been taken out in quite a while but the library has been busy before and so the shelf and the bookcase are both full we have a problem. Each time a person asks for a book the librarian will check the shelf and then check the bookcase before realising that the book has to be in the main library. The librarian each time then trots off to get the book from the library. If this library had a non cache system it would actually be quicker in this instance because the librarian would go straight to the book in the main library instead of checking the shelf and the bookcase.

As the fact that non cache systems only work in certain circumstances and so in certain applications CPU’s are definitely better with a decent amount of cache. Applications such as MPEG encoders are not good cache users because they have a constant stream of completely different data.

Does cache only store frequently accessed data?

If the cache memory has space it will store data that is close to that of the frequently accessed data. Looking back again to our library. If the first person of the day comes into the library and takes out Lord of the Rings, the intelligent librarian may well place Lord of the Rings part II on the shelf. In this case when the person brings back the book, there is a good chance that they will ask for Lord of the Rings part II. As this will happen more times than not. It was well worth the Librarian going to fetch the second part of the book in case it was required.

Cache Hit and Cache Miss

Cache hit and cache miss are just simple terms for the accuracy of what goes into the CPU’s cache. If the CPU accesses its cache looking for data it will either find it or it wont. If the CPU finds what’s its after that’s called a cache hit. If it has to go to main memory to find it then that is called a cache miss. The percentage of hits from the overall cache requests is called the hit rate. You will be wanting to get this as high as possible for best performance.

Must-Have Plugins To Supercharge Your Home Business WordPress Blog

After setting up your home business blog, learning how to generate leads online is one of the first steps to your online MLM success. How would you like to convert more of your home business blog visitors into leads and customers for your MLM business?

Your network marketing blog can be supercharged to enhance your lead generation efforts, and move you closer towards finding those prospects who will make your home based business a success.

Supercharging your home based business blog

There are certain plugins which will help put your MLM blog on steroids.

How valuable an asset would your home business blog be if it allowed you to generate more leads and prospects, for the same amount of effort? How do you think your business would look? Worrying about leads and prospects for your network marketing business is not something that would be on your mind anymore.

My top WordPress blog plugins to supercharge your MLM business blog

1. Akismet plugin
The internet is full of people trawling around, looking to leave spam comments all over. Spam is taken care of by this little plugin. The more traffic and visitors you get to your home business blog, the more comment spam that will come your way. Your blog will not look professional if you were to allow some of this spam. Imagine having a blog post where you’re showing your visitors how to generate network marketing leads online, and you have a comment talking about generic drugs for example. Every home business blog must absolutely have Akismet. Where your blog does not have spam comments, your readers and visitors are less likely to leave.

2. Google XML Sitemaps plugin
This plugin generates an XML sitemap of your entire site, and automatically submits it to the search engines. This XML sitemap is used by Google, to get a picture of your entire site, including its posts and pages. Effectively, this means that your pages and posts are indexed within the major search engines. Ensuring your content is optimized gives you more visitors, since your pages and posts are already indexed.

3. Dagon Design Sitemap Generator
The Dagon Design Sitemap Generator plugin creates an html (as opposed to XML) sitemap for your home business site. This sitemap gives users access to all your content and pages, via links. Create good quality posts and articles, and you can potentially keep a visitor on your site for longer, as they navigate the rest of your content. This sitemap generator can be customized to your desire, and so you can determine what pages and posts appear.

4. W3 total cache
This is an excellent caching plugin, and if used just right, it will speed up your network marketing blog by a large magnitude. Google, in its ranking algorithm, uses page load times as one its factors to determine how well your site ranks.

Google loves a fast-loading blog, and your MLM blog readers will appreciate the site speed too. We’ve all visited sites and blogs which take a very long time to load……how long did it take before you left that site?

Used in combination with Amazon’s S3 and CDN services, W3 total cache will boost your network marketing blog speed by unbelievable factors.

With a fast-to-load blog, your MLM blog readers are more likely to stay longer on your blog and read your articles and posts. You of course have to have very good quality content on your MLM blog.

5. Sexy Bookmarks plugin
With this plugin, readers can easily share your content. Giving access to over sixty social media platforms, this plugin allows your blog readers to share your content easily. This plugin gives your blog articles a wider viewership, as your readers get to share your amazing articles and posts with their friends and contacts on their social media profiles.

This is good as it helps you attract more visitors and hence generate more home based business leads from your visitors’ friends on their social media profiles.

6. SEO All-In-One-Pack
For the basic on-page SEO factors, this is the plugin that you want to have, unless you have a theme such as thesis.

If you wish to attract the best network marketing leads, ranking for relevant search terms on the search engines should be one of your major goals. Taking care of your on-page SEO factors goes a long way in helping you rank well on the search engines for your relevant terms. With good search engine rankings for your chosen terms, you get to attract more visitors to your MLM blog, and hence potentially generate better quality home business leads and prospects.

With the Thesis theme, SEO is in-built into the framework, and so the All-In-One-SEO plugin becomes unnecessary. If you have thesis, a lot of your SEO headaches are handled by the theme.

7. SEOPressor plugin
Imagine having a top-paid Search Engine Optimization consultant working beside you as you are creating your blog posts and article; if you have this plugin, you don’t have to imagine.

This plugin helps you by advising you on what to do with your target keywords:
a) This plugin tells you the most optimal place to put your main search term
b) It tells you whether your keyword density is too low or too high
c) This plugin highlights your main keyword terms, by italicizing it, bolding it, and underlining it, which of course is important for search engine rankings.

Even experienced search engine optimization professionals use SEOPressor to improve their SEO rankings for their target keywords. Attracting more visitors when you have high rankings for your search terms is thus achievable, and you also get to generate more leads for your MLM business.

Even if you already have an established MLM blog, SEOPressor can help you improve the articles on your blog, thus attain higher SEO rankings for your target keywords.

8. Yoast Breadcrumbs plugin

This little plugin is useful as it gives stickiness to your home business blog, by letting your readers know where they are, and how they can navigate your blog.

The links within Yoast Breadcrumbs are also useful to the search engines as they follow them, and get an indication as to your site structure. This helps you attain higher search engine rankings.

9. FB Like

The FB Like plugin lets your readers like your blog post, and this filters through to their Facebook profile. This link to your blog post is visible to your MLM reader’s friends and contacts on Facebook, and this is good for attracting new readers and possibly leads.

10. FB Share Button plugin
This button has the recognizable Facebook background, and you have undoubtedly seen it before. When a reader or blog visitor uses this plugin to share your blog article on their Facebook profile, their comment, together with a link to your article, is posted on their Facebook profile. This gives your blog post visibility and a wider audience to view your content. If your content is very good, then you can potentially generate a lot more multi-level marketing leads for your home business.

11. Thank me later plugin
This plugin lets you send your blog readers (who comment), a message, after they have left a comment on your blog. You can use this to connect with your commenters on a deeper level, or remind them to connect with you on the social media profiles, or subscribe to your feed. It adds that human friendly element to you. Network Marketing is about building relationships, so this plugin is handy to have.

12. Google Analyticator plugin
With this plugin, you can view Google analytics data within your WordPress blog, which is very important to you. Google analyticator allows you to view useful metrics about your home business blog:
a) Where do your blog visitors come from
b) It shows you the keywords used by visitors to get to your MLM blog
c) Which pages do they seem to like more than others

This information can help you optimize your MLM blog content, in order to attract more visitors. When you know which content your home business prospects and visitors seem to like, you can optimize your blog content to target more of the relevant keywords.

13. Tweetmeme Retweet button
The Tweetmeme Retweet plugin allows your home business blog readers to share your blog post with their twitter followers. This plugin includes a live counter, showing the number of times your blog post has been retweeted. If your blog article is good, the article will be retweeted a lot, inviting a lot of readers and potential MLM leads.

14. Statpress
Using Statpress, you can easily check which are the preferred posts by your blog visitors, in real-time. Statpress allows you to view what your blog readers are doing on your network marketing blog, in real-time. It tells you the human visitors, the spiders, etc.

15. Popup Domination plugin
While having a web form in your MLM blog side bar can help you greatly in generating leads online, a popup webform will undoubtedly increase your autoresponder sign-ups, and help build your network marketing list of leads and prospects.

With this plugin, your online lead generation efforts are given a boost. If you’ve had a look at some of the top marketers’ blogs, then you’ve probably seen the nice popup email opt-in forms. That’s Popup Domination in action.

Using this plugin saves you the hassle of having to design your popup web form.

This plugin works well with the major autoresponder services, and has been producing amazing results for some of the well-known marketers around.

If you want to increase your subscribers and opt-ins for your network marketing blog, then Popup Domination is a must have.

By using the plugins above, your MLM blog is more likely to get a boost in traffic, rankings and leads.

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 php.net, 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 apc.so 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.

configure.in:9: warning: underquoted definition of PHP_WITH_PHP_CONFIG

run info ‘(automake)Extending aclocal’

or see http://sources.redhat.com/automake/automake.html#Extending-aclocal

configure.in:32: warning: underquoted definition of PHP_EXT_BUILDDIR

configure.in:33: warning: underquoted definition of PHP_EXT_DIR

configure.in:34: warning: underquoted definition of PHP_EXT_SRCDIR

configure.in:35: 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
–with-php-config=/usr/local/php/bin/php-config

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.