Blogs

Optimizing a Drupal database: improving the performance

That is what you have when you don't optimize and maintenance properly your Drupal projects. A 4GB database which hits hugely the server performance. Just a couple of "magic tricks" and .... 194MB.

Magic? Not at all. If you have a problem with your server, with hangs up and things going very sloooow, check the cache. sessions and watchdog tables, and clear them.

It works like a charm :-)

Howto patch a Drupal module

Some contributtion to add to this Drupal module with which you have been working on?

Very easy, take note:

 

  1. Go to the folder of your module, previously cloned with git. For example, my contribution this morning: 
  2. git clone --recursive --branch 7.x-1.x http://git.drupal.org/project/cpn.git
  3. cd cpn
  4. Create a new branch, for example: git branch 1912834-weight
  5. Change to this branch to make the changes: git checkout 1912834-weight
  6. Make your changes
  7. Add them with: git add your-file-modified
  8. Commit them, git commit -m "comment your changes as much as possible"
  9. Create your new patch: git diff 7.x-1.x > cpn-weightsettings-1912834.patch
  10. That's it :-)

 

More info:

 

 

error: unable to create temporary sha1 filename ./objects/17: Permission denied

I have had this issue recently, with a git branch which did not want to to react to push. That's what a was having:


$ git pushgit@domain.net's password Counting objects: 5, done.
Delta compression using up to 2 threads.
ng objects: 100% (3/3), done.
Writing objects: 100% (3/3), 303 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
error: unable to create temporary sha1 filename ./objects/17: Permission denied
fatal: failed to write object

error: unpack failed: unpacker exited with error code
git@domain.net:/var/www/git/domain
! [remote rejected] HEAD -> master (n/a (unpacker error))
error: failed to push some refs to 'git@server:/var/www/git/domain'

The problem is a permissions one... but it will not work if you try to update the permissions in the server folder. You have to update the permissions in the server, but in .git folder:

chown -R git:git .git/

In my case git was the user who should have the permissions to write.

Once changed, the push in your local environment should work.

categorias: 

Drupal maintenance tasks

 

How important is having a database optimized. Doing some "basic" optimizations like clearing the cache, runing the Drupal cron and a couple of things more, your database can change from having 4 GB to just around 200MB... incredible? Not at all, the importance of maintenance tasks :-)

Which tasks? Mainly:

 

  • Clean / truncate the sessions table. This table can grow up to several millions of registers. 
  • Carefull with the spammers. Your comment table can grow up to similar amounts if too many spammers take a look at you. If the problem is big, simply delete with phpmyadmin:
  • delete from comments where status = '1';  // unpublished comments
  • delete from comments where status = '0';  // all published comments

 

 

Related @links:

 

Drupal developer links of the week (01-02-2013)

Some interesting links that I have found this week.

Problems in which i've been involved this week:

git Mini Howto

All you need to know to start faster in Git:

  • sudo git add .
  • sudo git commit -m "function findFriends added"
  • git push -u origin master

That's it :-)

categorias: 

Drupal Sprint London January 2013

After a nice day knowing new people and mainly learning, this is my contribution to the community in this first Drupal Sprint in London:

Doesn't seems too much, mainly because i've learned more than what i've really being able to give.

Documentation and tools which I've found useful:

 

Others:

 

Howto contributing a module to Drupal

 

,

 

  1. Think in some interesting project, and build your module,
  2. If you didn't, create a Drupal user, and a new sandbox for your module(s). Follow this instructions and commit your first lines of code http://drupal.org/node/1068950
  3. Work in your project, and when you are happy to publish your first stable release, go to the next step.
  4. Help the community, doing some reviews of other modules (3 at least): http://drupal.org/project/issues/search/projectapplications?status[]=2&status[]=7 (more info here: http://drupal.org/node/1410826)
  5. Create a new project aplication: http://drupal.org/project/issues/projectapplications

 

 

 

 

some git commands

 

 

try.github.com

sudo git reset --hard origin/8.x

issue summary template: http://drupal.org/node/1155816

http://core.drupalofficehours.org/

http://drupal.org/project/dreditor  --> for chrome/firefox

 

Novice tags are good for starting to contribute.

 

Applying a patch in Drupal core:

1. Download the patch,

2. apply: git apply -v [patch]

 

 

categorias: