Thursday, July 25, 2013

The most common mistake when load balancing with HAProxy

So, a while back, I was put in charge of a medium-sized site, which is running Drupal (probably known best for it's performance -- or lack thereof). At some point, we had to scale the website up, because it was getting more and more attention, so we went with HAProxy, because we heard good things about it. (We tried Amazon ELB, because we were already in the Amazon network, but that didn't work out for us)

So we installed HAProxy and pulled some different configurations on the internet, and got something working. This was about 1.5 years ago, and at that time, the website was getting about 900k unique visitors.

At first, the website was handling the traffic fairly OK with just 2 servers under the LB. Then we had to add another server, because we've developed some new features, with a major impact on the site's performance (we weren't allowed to switch from Drupal, so we couldn't optimize the code too much).

Tuesday, June 28, 2011

PayPal Integration

Howdy!

OK, so lately I've been talking about things I like, so I thought I'd also write about something I really really hate: PayPal integration.

PayPay has a pretty large documentation, but quite honestly I find most of it useless. To get something done, you have to either ask on the forums (which are really helpful) or download some sample code from them, to see how things should be done, so that you can write your own code. The only problem is that their sample source codes are pretty well hidden. It took me about 15 minutes to find it on Google (usually it takes me maximum 5 minutes). So after finding the source code, downloading it and running it, everything is fine. The code works perfectly, and is pretty easy to understand.

Several weeks ago I integrated direct payments and pre-approved payments (for the ones who know what I'm talking about) and let me tell you: it was a pain in the ass. It took me about 1 week to get the basic stuff working, which is unacceptable. Now I really have a better understanding of how PayPal actually works, tho, so I think it was worth it.

Anyways, for the ones who want to do this (with PHP), you will need: solid PHP knowledge, cURL understanding, to read the PayPal documentation thoroughly and a lot of patience and calm.

Also, for the ones who want a more "basic" integration (with PayPal IPN -- Instant Payment Notification), there is a class written in PHP located here, which will help you a lot and is very easy to use.

See y'all next time.

Tuesday, June 14, 2011

See Sharp

No, this is not a post about some kind of sharp seeing, just a post about the popular programming language called: C# (Visual C#).

I've had the opportunity to learn C# in highschool (at a very basic level), but starting from there, I've learned a lot on my own and I can say I've done some pretty cool stuff, that I couldn't do (this easily) in other programming languages.

For example, I made a program which lets you manage the grades in a school. It also automatically calculated the final grades (grading system where I live is different from the US) and warned you if a student didn't have enough grades or wasn't at school enough to calculate his final mark. It was pretty cool and I've won some contest with this project.

Another cool thing, which I didn't get to finish, was a client-server application which acted like a very simple DOS-messenger. The server just listened for requests and redirected them to the proper client. The client had to just type the user it wanted to send a message to and the actual message. Pretty cool also.

C# is a very nice language to program in, it's actually one of the few environments, which I actually enjoy working with. It provides some nice tools like controllers for many useful stuff.

I didn't have the chance to try programming sites in C# (ASP.NET), but I will have to real soon and I will come back with a post about that aswell.

Until next time,
Yours truly,
Geek Master.

Sunday, June 12, 2011

Zend Framework

Hello.

In the past few days, I've learned pretty much about the Zend Framework, so I thought I'd share my impressions about it.

I've heard several times about Zend in the past (Zend is pretty much the reason why PHP is so popular and a damn good web language), but I've never had the ambition to try to learn it. Now that I've started working, I had to learn how to use it. I'm still at the beginning, but I know the basics and from what I've seen, it's pretty great!

So then what is Zend Framework (ZF)? Zend Framework is basically a collection of scripts written in PHP (actually classes), which give you the ability to write less, more efficient and better code than using normal PHP, plus, they have very useful tools. ZF should not be mistaken with Zend Server, which is a server application which is optimized to be used with ZF.

Is it free? Yes! When I saw the Zend main site, I didn't see anything about it being free, but I asked some friends and they told me that the Framework is free, but the server is not (although they have the free community edition if I'm not mistaken).

So what tools does it provide? Well just a few are: form input validation, multiple DB connection tools, credit card validation, some kind of a session management system, an authentication system and these are only a few I've worked with.

So my conclusion is: it's a good tool, but don't use it if you don't need it. It's best to use it for medium-large sites.

Saturday, January 15, 2011

Hello Geeks!

Hello world!

I know this is probably pretty obvious, but I just want to tell you guys something about this blog. Well, I'm not sure exactly what I'm going to write, but it will mainly be about computers and programming. As I know only several programming languages, I'm only going to write about them. Also, if you're looking for something about hardware, this is not the place to look for it - I don't like talking about that.

Well that's it for now, signing off.