Why RAM is slower than some things like CPU cache.

A software person should know enough about hardware to write software easily but I confess I only recently figured out different types memory exist. Namely RAM and CPU cache.

Why both RAM and drive storage exist is an easier thing to understand although it was recently  made harder by the arrival of flash drives. RAM stands for random access memory . HDDs certainly are not random access but flash drives are. This is why HDD performance can be improved with defragging but not flash drives. Flash Drives are also refereed to as SSDs. One reason RAM has been faster than SSDs is because SSDs are non volatile where RAM is volatile. To make the memory in your computer stick when you shut it down requires a longer time to alter the hardware than something that is just influenced by the flow of current which inevitably stops when the computer is turned off.

Now on to CPU cache. It turns out the speed of light is not infinite. Therefore, the time it takes for information to travel is dependent on how far it has to go. In the case of computers this is current running along a conductive path. Given that there is also a minimum to the size of which manufacturers are capable of making small hardware, there is a delay between memory and computations on that memory. The more memory you are trying to access, the farther away it will potentially be because memory cells can only be packed so tightly together. Thus, if you work with a small amount of memory, provided your algorithm allows it, you can compute faster. CPU cache is made of smaller divisions of memory particularly for executing things fast. This often serves as a cache on information in RAM but CPU registers could also be considered a form of memory too. CPU caches come in different sizes for algorithms requiring more memory, namely L1, L2 cache etc. The smaller the level, the less memory is used and the faster your code can execute with.

Http vs plain old sockets

In the old days. Most services did not use HTTP. FTP. IRC, SMTP specify there own language for communication. Nowadays, many more things are brought via Http. Social media apps. RSS. Git over http. Email APis over http. This site for example.

I can think of some examples why this is the case.

  1. HTTP performs slow so restricted networks would be more likely to allow it as they are less likely to connect to things like file sharing networks.
  2. HTTP is connection-less (or conventionally so (see long polling) which reduces memory consumption .
  3. HTTP can be tested in a web browser which is slightly easier than using telnet.
  4. HTTP supports compression and encryption headers.
  5. HTTP has a standard for submitting the domain name allowing for Virtual Hosts
  6. HTTP supports basic auth.
  7. Probably other stuff.

Sockets does not provide this stuff out of the box and you would have to roll your own. Web sockets are the connectionful version of HTTP.

HTTP of course adds it’s own overhead with the HTTP method names like GET but if you can get past that, it can be pretty lucrative.

live exposure of a container port

Say you have this docker container, but you want to expose a port that is not already open. One good way is to save the image and restart. This however, will cause some downtime. You also may not want any process to stop because you have not added all the daemons to your startup script. This may lead to “sad times”.

One cool way to expose this port is to is by using a reverse SSH tunnel. Reverse tunnels require specific SSH daemon settings and you also may not want to be bothered ensuring that it’s set right. Instead, a docker container can be run specifically to run SSH for this purpose. The command to do this, image provided by docker user tifayuki, is as follows.

Set mypass to the ssh password you want to use to for the reverse tunnel.

This command will expose port 81 on your container. port 23 is chosen as the ssh server that will be used for reverse tunneling.

Then run this for the container you want a port exposed on. your.domain.name being your external domain or IP address.

On Education

I used to not see education as much more than a tool for learning. Thinking more generally, I have come to the conclusion that education offers many more benefits than just learning. I have also found learning done in the form of education only forms a small subset of that there is to learn.

First off there is the prevalence of school. Why does it exist? School can be thought of as a large form of baby sitting. If teaching didn’t exist there would still be a need for collective childcare simply to reduce the burden on working parents. Secondly if adolescents are to be looked after so they don’t harm themselves, they may as well learn something. In fact, education can form as a protection against poor care. If the students aren’t learning they are more likely to injure themselves or break other rules their own parents would not allow.

Education is a great way to network. Think of the people you have met in your life. Chances are it was in some form of educational environment. Although possibly not the best way to arrange people, it seems hard to find a simpler way to allow people to network than to make them all learn something similar.

Education usually involves tests. These can be an indicator of good will. If people were given unlimited time to make there way though life and education was not valued, there would be more time for people to cheat systems and ultimately corrupt interpersonal endeavors.  Education chews up a lot of peoples time giving them less time to come up with deceiving communication.

Education also seems to be somewhat essential in communication. Communication is very often arbitrary and two words can be very much as good as each other. Education seems to help normalize language so that it doesn’t fracture into the mess that can be seen in less educated disciplines.

Education is not without its downsides. Firstly it takes an awful lot of time. Much of it is learning words for concepts you could of explained yourself using simpler language. Also, I have found there is a lot of things that is not so good at teaching.

Just think of how much maths you did in school. Many people hate it and try to avoid using it.Try for instance actually counting the change you receive at cash registers. I once tried it out of curiosity and I was shocked to find how often people charged incorrectly for orders. Even more embarrassing is when you tell them of their mistake and they proceed to make another one. I know they are not all being dodgy because many people undercharge which can only reasonably be explained by a mistake.

Moving back onto the subject of maths in general. The reason I believe there is so much of it in education is because it formalizes so well. Great mathematicians have built grand theories accurate to every properly made objection. This has meant that the core of maths had to be rigorous and also tight in it’s abstractions. Learning maths forms a basic IQ test but it is not without the criticism that it only measures peoples abilities to follow instructions and less things like creative abilities or empathy.

The real world is cluttered with things that are difficult to formalize. Sometimes this is because they are too new. Sometimes it is because they change too often. Other times they rely on abstractions that just haven’t seeped well into societies subconscious. Whatever the reason they are there. Where is the manual for example on playing the stock market?

The stock market has a strange tendency that if an idea becomes widespread enough, people try to game it by using financial instruments. Something similar can be can said about socializing.

If you give too many gifts to someone they may be liable to think you are trying too hard to win favor and become labelled creepy.

Sometimes knowledge falls under the dominion of philosophy and if a culture excepts the idea too well it can become victim to other cultures. Sometimes ideas are politically incorrect or just too difficult to measure. Remember for example that psychologists are not allowed to conduct fully isolated studies on humans as this would be inhumane if not just really expensive and time consuming.

My point I’m trying to make is that unlike what some say there is knowledge outside of google. I also think given the number of things there are to learn there are things that know one else knows. Another point is that if something can be learned from educational material, it’s probably not very sought after as there are already many practicing what is taught. To be paraphrased, Oscar Wilde once said:

Education is an admirable thing. But it is well to remember from time to time that nothing that is worth knowing can be taught.

Site specific stats are a bad for deciding browser support.

Say you have a site and 0.01% of people use IE8 that is not a good reason not to support it because those people that don’t use the site won’t show up as often.

Even if you do use The Unique visitors option this is still a misleading statistic because most people don’t use static IPs. If they use mobile devices, those will be even more likely to use dynamic IP’s. There is more to this however.I speculate that people using old browsers exists in clusters of old browser networks, so a bottleneck has been created.

Lastly, I would like to say that people using the browsers that came with their operating system are probably the least likely to be able to install a new browser and so the importance of browser availability is only more important.