| |
Booking.com interview
compiled from the internet
Booking.com interview
Booking.com interview Interviewed Aug 2011 in Amsterdam (Netherlands) (took a day)
1. How would you display the top 5 repeating error messages in a log file without timestamps 2. How would you provision 100 Linux Web Servers, what considerations should you make 3. What tools do you know for debugging network issues 4. What considerations would you give when monitoring a replicated chain of databases
The UK techie did give some time to explaining their environment which consists of 12 sys admins working with approx 100 developers in Amsterdam. --------------------------------------------------------------------------------------------------------------- 1. How would you display the top 5 repeating error messages in a log file without timestamps ---------------------------------------------------------------------------------------------------------------
Perl program should do the following: a. from Apache error.log file strip time-stamp in all error records b. built error_hash where KEY is Error_description, and VALUE is the repeated occurrence of that record with the same Error_description c. sort the error_hash by occurrence of that Error_description d. display top five occurring errors
------------------------------------------------------------------------------------------------------------ 2. How would you provision 100 Linux Web Servers, what considerations should you make? ------------------------------------------------------------------------------------------------------------ Provisioning policies a. provisioning is internal or external? b. static webpages or database-driven site?
1: -upper layer comprised of reverse-proxies (nginx, varnish, squid) 2: -webserver layer: (nginx webserver + FastCGI, apache, lighttpd, etc.) 3: -database layer: (mysql in clustering active-active or master/slave replication? or Amazon EC2 RDB) 4: -storage layer: shared-storage done via NFS, or DRBD, or cloud-technologies with amazon
x: on all systems, you can employ virtualization & advanced networking techniques (NAT) in order to avoid 100 physical servers for 100 web services (daemon) y: for the management I would use "puppet" or RPM or a similar software z: for the server monitoring i would use Cacti or Zabbix, and for bandwidth monitoring MRTG. A provisioning policy grants access to many types of managed resources, such as Linux LAMP Servers, Windows NT® servers, and Solaris servers.
Each provisioning policy consists of the following components: General Information Membership Entitlements
A provisioning policy must target one or more service instances, service types, or a service selection policy. System administrators can use provisioning policy parameters to define attribute values that are required and values that are optional.
A provisioning policy defines the accounts and access that are authorized to users or automatically provisioned for users by the user's role. When account and access have been authorized to a user by a provisioning policy, they can be requested by the user. A provisioning policy can be used to support role-based provisioning, in which accounts and access are automatically provisioned to a user, based on the user's roles.
Provisioning policies are important to support security compliance. IBM Tivoli Identity Manager evaluates all account and access requests based on the provisioning policy to identify accounts and access that are not authorized and take appropriate actions to handle noncompliant account and access. Based on the enforcement configuration on the service, Tivoli Identity Manager can either mark the account or access as noncompliant; suspend the account; alert administrator to revoke disallowed privilege; or automatically correct the account or access and make it compliant. A provisioning policy provides a key part of the framework for the automation of identity life cycle management.
Tivoli Identity Manager provides APIs that interface to information about provisioning policies defined in Tivoli Identity Manager, and interface to the access granted to an individual task. These APIs can be used effectively to generate audit data.
When two or more provisioning policies are applied to the same user, a join directive defines how to handle attribute values from different policies. To work with policy joins or customize them, go to the navigation tree and select Configure System > Configure Policy Join Behaviors.
Provisioning policies can be mapped to services of a distinct portion or level of the organizational hierarchy. The business unit to which the provisioning policy belongs determines the services the policy governs. The scope of the provisioning policy indicates whether to cover services in the same level of the business unit or the subtree of the business unit. An entitlement in the provisioning policy support different types of service targets, including all services, services of same type, services defined by service selection policy; or specific service instance. In all cases, the services must be within the specified scope of the business unit where the policy is defined. A service selection policy enables service selection base on person attributes.
Seamless Provisioning and Deployment The Web Farm Framework 2.2 is designed to enable you to create group of servers and setup provisioning for them with a one step process that is automated and keeps the web farm up to date. You can customize what gets provisioned, and include additional platform components. You can configure provisioning policy and add additional content to the farm. In addition, you can use the Web Farm Framework to view up-to-date status of provisioning and health of the servers in the farm.
---------------------------------------------------------------------------------------------------------- What's the difference between a class method and an instance method?
by Byron Tymvios Class methods are methods which are declared as static. The method can be called without creating an instance of the class. Class methods can only operate on class members and not on instance members as class methods are unaware of instance members. Instance methods of the class can also not be called from within a class method unless they are being called on an instance of that class. Instance methods on the other hand require an instance of the class to exist before they can be called, so an instance of a class needs to be created by using the new keyword. Instance methods operate on specific instances of classes. Instance methods are not declared as static.
* An instance method applies to an instance of the class (i.e. an object) whereas a class method applies to the class itself. In C# a class method is marked static. Methods and properties not marked static are instance methods.
* Simply, a class method (aka "static method") is a property for the WHOLE class, so its's called as className.methodName(). a class method can be used with just the class name.
BUT for instance methods, then each object have their own copy of them, so they r called as objectName.instanceMethodName().
Second difference : -class ("static") methods can access ONLY static fields -but instance methods can access ANY fields of the class.
A third a bit advanced difference is that class (Static) methods are bound to the class at compile time, while instance methods are bound to their objects at run time... I would add that a class method is called a "static" method in many other languages. And to answer the original question, accessors are instance methods because they are setting and getting the state of a specific instance. In the above example, NSArray count returns the number of objects in a specific instance.
Answer: Instance methods can be called by the object of a Class whereas static method are called by the Class. When objects of a Class are created, they have their own copy of instance methods and variables, stored in different memory locations. Static Methods and variables are shared among all the objects of the Class, stored in one fixed location in memory.Static methods cannot access instance variables or instance methods directly-they must use an object reference. Also, class methods cannot use the this keyword as there is no instance for this to refer to. Read more: http://wiki.answers.com/Q/Difference_between_instance_method_and_static_method_in_java#ixzz1vIQWuLiu
Are instance methods the accessors (getters & setters) while class methods are pretty much everything else? -----------------------------------------------------------------------------------------------------------
============================================== Setting Up Replication Servers One form of database "replication" involves copying a database to another server. But then you have to repeat the operation later if the original changes and you want to keep the copy up to date. To achieve continual updating of a secondary database as changes are made to the contents of a master database, use MySQL's live replication capabilities. This gives you a means of keeping a copy of a database and making sure that changes to the original database propagate on a timely basis to the copy automatically. Replication Concepts Database replication in MySQL is based on the following principles: In a replication relationship, one server acts as the master and another server acts as the slave. Each server must be assigned a unique replication ID. The master and the slave must begin in a synchronized state with identical copies of the databases to be replicated. After that, updates are made on the master server and propagate to the slave. Updates are not made directly to the replicated databases on the slave. The means of communication of updates is based on the master server's binary update logs, which is where updates that are to be sent to the slave are recorded. Consequently, binary logging must be enabled on the master server. The slave server must have permission to connect to the master and request updates. The slave's progress is tracked based on replication coordinates, which consist of the name of the binary log file from which the slave currently is reading and its position within the file. You can have multiple slaves per master, but not multiple masters per slave. However, a slave can serve as a master to another slave, thus creating a chain of replication servers. ---------------------------------------------------------------------------------------------------
a. What are database indexes? b. What is data base transaction? c. How would you store/copy an object in perl? d. What is stringify function, what is “stringification” in Perl? e. Mem and Grep function in perl, how to interchange them, and what is better and when? f. What is the data normalization? g. Open filehandle has 2 and sometimes 3 arguments, can it be dangerous and when? h. How would you eliminate/count the double objects from the list? i. open my $FH, '<', $filename vs open FH, "<$filename"; by Simon
--------------------- a. What are database indexes? --- Put simply, database indexes help speed up retrieval of data. The other great benefit of indexes is that your server doesn’t have to work as hard to get the data. They are much the same as book indexes, providing the database with quick jump points on where to find the full reference (or to find the database row). There are both advantages and disadvantages to using indexes, however. A database index is a data structure that - improves the speed of data retrieval operations on a database table - at the cost of slower writes and increased storage space. Indexes can be created using one or more columns of a database table, providing the basis for both rapid random lookups and efficient access of ordered records. In a relational database, an index is a copy of one part of a table. ---- b. What is the data base transaction? In database, a database transaction is a logical unit of database operations which are executed as a whole to process user requests for retrieving data or updating the database. Transaction should have four properties: atomic, consistent, isolated and durable. These properties of database transactions are often referred to by the acronym ACID. ---- c. How would you store/copy an object in perl? Object-oriented programming in Perl is easy. Forget the heavy theory and the sesquipedalian jargon: classes in Perl are just regular packages, objects are just variables, methods are just subroutines. The syntax and semantics are a little different from regular Perl, but the basic building blocks are completely familiar. The one problem most newcomers to object-oriented Perl seem to stumble over is the notion of references and referents, and how the two combine to create objects in Perl. So let's look at how references and referents relate to Perl objects, and see who gets to be blessed and who just gets to point the finger.
----- d. What is stringify function, what is “stringification” in Perl? "stringification" happens any time that perl needs to convert a value into a string. This could be to print it, to concatenate it with another string, to apply a regex to it, or to use any of the other string manipulation functions in Perl. Stringification methods are called when an object is used in a context where a string is expected. The method describes how to represent the object as a string. So for instance, if you say print object; then since print is expecting a string, it's actually passing the result of the stringify method to print. Regular expression retrieved from user input, as a string stored in the variable $userinput: $myregex = qr/$userinput/
--- i. when opening a file handle in perl, when you should use the three-argument form, instead two-argument form?
open my $FH, '<', $filename vs open FH, "<$filename"; http://stackoverflow.com/questions/3469659/what-is-modern-perl
You may (and usually should) use the three-argument form of open to specify I/O layers (sometimes referred to as "disciplines") to apply to the handle that affect how the input and output are processed (see open and PerlIO for more details). For example:
open(my $fh, "<:encoding(UTF-8)", "filename") || die "can't open UTF-8 encoded filename: $!";
opens the UTF8-encoded file containing Unicode characters; see perluniintro. Note that if layers are specified in the three-argument form, then default layers stored in ${^OPEN} (see perlvar; usually set by the open pragma or the switch -CioD) are ignored. Those layers will also be ignored if you specifying a colon with no name following it. In that case the default layer for the operating system (:raw on Unix, :crlf on Windows) is used. http://perldoc.perl.org/functions/open.html
|
|