Monday, November 30, 2009

Logikit Framework 1.0.1 released

This release was intended to be a "small changes package", and was scheduled for a bit later. Although the first version was released only about a month ago, the download stats were way beyond than I expected and there are already some people I know, using it in their own projects, so I decided to release an earlier version with a couple of additions to the existing features and some changes, along with three new libraries: Image manipulation, ftp and email classes.

Don't panic when you will see the size of the distribution file is lowered, as it is highly optimized now. You can get it at http://framework.logikit.net

This month (Dec 2009) I will start a relatively big project to be built 100% on Logikit::Framework, which will be an acid test, as I will need to implement almost every feature there, also will develop new libraries. All those will make part of version 1.0.2 which will eventually be released right after the project completion.



Well, enjoy it!

Wednesday, November 4, 2009

Logikit Framework Benchmarks

Finally I had time to complete the "Hello World!" benchmarking for Logikit:.Framework.

You will find detailed results from Apache Bench. I also performed some good tests to compare it with a couple of frameworks, but I want to leave the comparison to others and will just publish the results.

Those tests are still so far from having a scientific value, but at least would give you an idea.
What I have to say as an "a-posteriori" opinion is that they are just close to a very native PHP "Hello World!"

SYSTEM:
CPU: 2 X Intel(R) Pentium(R) T3400 2.16 GHZ
Memory: 2 GB
OS: Ubuntu 9.10 (Karmic)

TEST 1

Concurrency Level: 1
Time taken for tests: 60.000 seconds
Complete requests: 9845
Failed requests: 0
Write errors: 0
Total transferred: 4164435 bytes
HTML transferred: 118140 bytes
Requests per second: 164.08 [#/sec] (mean)
Time per request: 6.094 [ms] (mean)
Time per request: 6.094 [ms] (mean, across all concurrent requests)
Transfer rate: 67.78 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 5 6 1.9 5 51
Waiting: 5 6 1.9 5 51
Total: 5 6 1.9 5 52

Percentage of the requests served within a certain time (ms)
50% 5
66% 5
75% 6
80% 7
90% 10
95% 10
98% 10
99% 11
100% 52 (longest request)

TEST 2

Concurrency Level: 1
Time taken for tests: 60.002 seconds
Complete requests: 9746
Failed requests: 0
Write errors: 0
Total transferred: 4122558 bytes
HTML transferred: 116952 bytes
Requests per second: 162.43 [#/sec] (mean)
Time per request: 6.157 [ms] (mean)
Time per request: 6.157 [ms] (mean, across all concurrent requests)
Transfer rate: 67.10 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 5 6 5.9 5 402
Waiting: 5 6 5.2 5 402
Total: 5 6 5.9 5 402

Percentage of the requests served within a certain time (ms)
50% 5
66% 5
75% 6
80% 7
90% 9
95% 10
98% 10
99% 10
100% 402 (longest request)

TEST 3

Concurrency Level: 1
Time taken for tests: 60.001 seconds
Complete requests: 9834
Failed requests: 0
Write errors: 0
Total transferred: 4159782 bytes
HTML transferred: 118008 bytes
Requests per second: 163.90 [#/sec] (mean)
Time per request: 6.101 [ms] (mean)
Time per request: 6.101 [ms] (mean, across all concurrent requests)
Transfer rate: 67.70 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 5 6 2.3 5 77
Waiting: 5 6 2.1 5 77
Total: 5 6 2.3 5 77

Percentage of the requests served within a certain time (ms)
50% 5
66% 5
75% 6
80% 7
90% 9
95% 10
98% 10
99% 11
100% 77 (longest request)

TEST 4

Concurrency Level: 1
Time taken for tests: 60.003 seconds
Complete requests: 9958
Failed requests: 0
Write errors: 0
Total transferred: 4212234 bytes
HTML transferred: 119496 bytes
Requests per second: 165.96 [#/sec] (mean)
Time per request: 6.026 [ms] (mean)
Time per request: 6.026 [ms] (mean, across all concurrent requests)
Transfer rate: 68.55 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 5 6 4.0 5 262
Waiting: 4 6 3.8 5 262
Total: 5 6 4.0 5 262

Percentage of the requests served within a certain time (ms)
50% 5
66% 5
75% 6
80% 6
90% 8
95% 10
98% 10
99% 10
100% 262 (longest request)

TEST 5

Concurrency Level: 1
Time taken for tests: 60.003 seconds
Complete requests: 9769
Failed requests: 0
Write errors: 0
Total transferred: 4132287 bytes
HTML transferred: 117228 bytes
Requests per second: 162.81 [#/sec] (mean)
Time per request: 6.142 [ms] (mean)
Time per request: 6.142 [ms] (mean, across all concurrent requests)
Transfer rate: 67.25 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 5 6 3.0 5 140
Waiting: 5 6 2.7 5 140
Total: 5 6 3.0 5 141

Percentage of the requests served within a certain time (ms)
50% 5
66% 5
75% 6
80% 7
90% 9
95% 10
98% 10
99% 11
100% 141 (longest request)

163.83

Monday, November 2, 2009

Cons and Pros of a new PHP 5 framework - Why another one?

Though we are good old friends with PHP since PHP 3 days and I made my living on it, I always considered myself as a student rather than an expert, and always enjoyed to learn from other people's experiences. When I faced a problem, I found more logical to look for the footsteps of others before trying to re-invent the wheel. This helped me develop a point of view on where to use the existing ones, where to manipulate them and where to design the wheel from scratch; "how to think" for short.

Troughout my programming life, I've encountered several problems, worked on various projects both by myself or as a member of a team, and besides my own experiences, I had the chance to hear how other programmers approached to a spesific programming or logical problem, even most of them were daily and recurring ones, especially for themselves!

I strongly guess the first application framework started as a result of the same feeling: We do some common things in every new project, and most of us use some re-usable code and write wrappers around them if we are experienced enough, but to put them as a whole is always there as a new problem with each new project, as the scope of the new project is seldom the same as the previous one, and if your last project took -say- eight months, if you are a person who does not remember everything he has done in his whole life like me, this would also mean another learning curve, even if the teacher is yourself and the curve is relatively short... and needless...

Having past this point, some years ago, not very long after PHP 5 started, I started to look for a good basis which would be good for projects at any scope, and saw with great happiness I wasn't alone with most of my thoughts, and with great vision, people already started to code some frameworks for PHP 5 to take advantage of the object-oriented features to have a more re-usable code, but helas, it was still PHP 4 days for anyone else. If I'd use their frameworks without any objection, I still needed to look for the server capabilities first, and most of I coded, I needed to deploy, so I needed to go with my own solutions for some time more.

Then, some day I heard of Ruby On Rails and the MVC pattern. That sounded logical, but I couldn't take another fight to use Ruby and advocate it, and not so long after, I met CodeIgniter. I feel I have almost the same opinion on it since my first day: Man, it was something usable! It also worked with PHP 4 and let the programmer keep everything in shape. Most important: not too hard to dive in. This was definitely something new for me, and as CI is one of the most popular frameworks nowadays, I guess it's valid for so many other programmers.

I believe CI was a kicking-point for a couple of other frameworks as well, however by time I felt it lacked some many important features for me as the life continued on, while those points might be considered as "features" for some others. Just to name a few one, they had good form handling and validation features, but not quite separated from the rest of your programming logic, as they wanted to validate any data by principal, not only forms, whereas in the real life, most of the validation tasks are for the data coming from the forms. Another one was that they didn't want to use code generators, most probably as they wanted to leave the coder free with their decisions, or perhaps for another reason. But for me, it's an advangate rather than a disadvantage to use them, as long as it's left to your choice.

So to name them as well, I also met Symphony which was an answer to use a code generator and also Cake. Cake was strict, Symphony was better, and lastly Zend.
I just want to ask a simple and honest question and close the Zend case: If it wasn't named "Zend", really how many people would use it?

So within time, I came to a point where I was pretty sure about what I really needed from a framework as a programmer:
- Documentation (Without it, I can't understand it's really not rocket science.)
- Performance. (It is of the essence especially when you deal with sites with high traffic.)
- Usability. (We are humans. We will use it, not robots.)
- Separation of logics: A required MVC implementation to force me write good code. I'm a very lazy person and if I have the db connection within the controller, I'd tend to use it.
- In addition but not required: Separation of form and validation logics: My forms and my validators "need to know about each other". If I will "define" a form, my validator must also have capabilities to use those definitions, but this must be in a very libertarian way: To do that, I must not define also the layout of the form within my general wiew, but let people use my form components however they wish within their design, even they can be automatically generated.
- As a consequence of the previous: The programmer must not be forced to use any template engine, but still preserve the rights to take advantage of a good caching mechanism.
-Ajax Capabilities: A PHP programmer's almost dead without Ajax. He needs a hand.
- A code generator with all ajaxified good pagination, sorting and validation capabilities.
- A good library for any task (That I don't have with 1.0 release)

Those are mine standards that need to come out of the box, and I could hardly see them together within another framework . I believe I have achieved most of the points above with the earlier 1.0 release and all by myself and if you, the programmer reading those lines will contribute, we may have much much more.

By the way, the address for the framework is http://framework.logikit.net